/* Minification failed. Returning unminified contents.
(7113,16-24): run-time error JS1010: Expected identifier: function
(7195,16-24): run-time error JS1010: Expected identifier: function
(7514,19-20): run-time error JS1010: Expected identifier: .
(7514,19-20): run-time error JS1195: Expected expression: .
(7515,19-20): run-time error JS1010: Expected identifier: .
(7515,19-20): run-time error JS1195: Expected expression: .
(7516,19-20): run-time error JS1010: Expected identifier: .
(7516,19-20): run-time error JS1195: Expected expression: .
(7517,19-20): run-time error JS1010: Expected identifier: .
(7517,19-20): run-time error JS1195: Expected expression: .
(7520,23-24): run-time error JS1010: Expected identifier: .
(7520,23-24): run-time error JS1195: Expected expression: .
(7538,27-28): run-time error JS1010: Expected identifier: .
(7538,27-28): run-time error JS1195: Expected expression: .
(7539,27-28): run-time error JS1010: Expected identifier: .
(7539,27-28): run-time error JS1195: Expected expression: .
(7540,27-28): run-time error JS1010: Expected identifier: .
(7540,27-28): run-time error JS1195: Expected expression: .
(7595,19-20): run-time error JS1010: Expected identifier: .
(7595,19-20): run-time error JS1195: Expected expression: .
(7596,19-20): run-time error JS1010: Expected identifier: .
(7596,19-20): run-time error JS1195: Expected expression: .
(7598,19-20): run-time error JS1010: Expected identifier: .
(7598,19-20): run-time error JS1195: Expected expression: .
(7599,19-20): run-time error JS1010: Expected identifier: .
(7599,19-20): run-time error JS1195: Expected expression: .
(7600,19-20): run-time error JS1010: Expected identifier: .
(7600,19-20): run-time error JS1195: Expected expression: .
(7602,19-20): run-time error JS1010: Expected identifier: .
(7602,19-20): run-time error JS1195: Expected expression: .
(7603,19-20): run-time error JS1010: Expected identifier: .
(7603,19-20): run-time error JS1195: Expected expression: .
(7605,19-20): run-time error JS1010: Expected identifier: .
(7605,19-20): run-time error JS1195: Expected expression: .
(7607,19-20): run-time error JS1010: Expected identifier: .
(7607,19-20): run-time error JS1195: Expected expression: .
(7608,19-20): run-time error JS1010: Expected identifier: .
(7608,19-20): run-time error JS1195: Expected expression: .
(7609,19-20): run-time error JS1010: Expected identifier: .
(7609,19-20): run-time error JS1195: Expected expression: .
(7611,19-20): run-time error JS1010: Expected identifier: .
(7611,19-20): run-time error JS1195: Expected expression: .
(7615,23-24): run-time error JS1010: Expected identifier: .
(7615,23-24): run-time error JS1195: Expected expression: .
(7616,23-24): run-time error JS1010: Expected identifier: .
(7616,23-24): run-time error JS1195: Expected expression: .
(7715,31-32): run-time error JS1010: Expected identifier: .
(7715,31-32): run-time error JS1195: Expected expression: .
(7724,27-28): run-time error JS1010: Expected identifier: .
(7724,27-28): run-time error JS1195: Expected expression: .
(7737,23-24): run-time error JS1010: Expected identifier: .
(7737,23-24): run-time error JS1195: Expected expression: .
(7757,23-24): run-time error JS1010: Expected identifier: .
(7757,23-24): run-time error JS1195: Expected expression: .
(7766,27-28): run-time error JS1010: Expected identifier: .
(7766,27-28): run-time error JS1195: Expected expression: .
(7771,23-24): run-time error JS1010: Expected identifier: .
(7771,23-24): run-time error JS1195: Expected expression: .
(7821,39-40): run-time error JS1010: Expected identifier: .
(7821,39-40): run-time error JS1195: Expected expression: .
(7824,43-44): run-time error JS1010: Expected identifier: .
(7824,43-44): run-time error JS1195: Expected expression: .
(7855,19-20): run-time error JS1010: Expected identifier: .
(7855,19-20): run-time error JS1195: Expected expression: .
(7860,23-24): run-time error JS1010: Expected identifier: .
(7860,23-24): run-time error JS1195: Expected expression: .
(7894,19-20): run-time error JS1010: Expected identifier: .
(7894,19-20): run-time error JS1195: Expected expression: .
(7896,19-20): run-time error JS1010: Expected identifier: .
(7896,19-20): run-time error JS1195: Expected expression: .
(7898,19-20): run-time error JS1010: Expected identifier: .
(7898,19-20): run-time error JS1195: Expected expression: .
(7899,19-20): run-time error JS1010: Expected identifier: .
(7899,19-20): run-time error JS1195: Expected expression: .
(7900,19-20): run-time error JS1010: Expected identifier: .
(7900,19-20): run-time error JS1195: Expected expression: .
(7901,19-20): run-time error JS1010: Expected identifier: .
(7901,19-20): run-time error JS1195: Expected expression: .
(7902,19-20): run-time error JS1010: Expected identifier: .
(7902,19-20): run-time error JS1195: Expected expression: .
(7904,19-20): run-time error JS1010: Expected identifier: .
(7904,19-20): run-time error JS1195: Expected expression: .
(7905,19-20): run-time error JS1010: Expected identifier: .
(7905,19-20): run-time error JS1195: Expected expression: .
(7906,19-20): run-time error JS1010: Expected identifier: .
(7906,19-20): run-time error JS1195: Expected expression: .
(7917,23-24): run-time error JS1010: Expected identifier: .
(7917,23-24): run-time error JS1195: Expected expression: .
(7918,23-24): run-time error JS1010: Expected identifier: .
(7918,23-24): run-time error JS1195: Expected expression: .
(7974,27-28): run-time error JS1010: Expected identifier: .
(7974,27-28): run-time error JS1195: Expected expression: .
(7975,27-28): run-time error JS1010: Expected identifier: .
(7975,27-28): run-time error JS1195: Expected expression: .
(7977,27-28): run-time error JS1010: Expected identifier: .
(7977,27-28): run-time error JS1195: Expected expression: .
(7992,23-24): run-time error JS1010: Expected identifier: .
(7992,23-24): run-time error JS1195: Expected expression: .
(7995,27-28): run-time error JS1010: Expected identifier: .
(7995,27-28): run-time error JS1195: Expected expression: .
(8008,27-28): run-time error JS1010: Expected identifier: .
(8008,27-28): run-time error JS1195: Expected expression: .
(8013,23-24): run-time error JS1010: Expected identifier: .
(8013,23-24): run-time error JS1195: Expected expression: .
(8048,43-44): run-time error JS1010: Expected identifier: .
(8048,43-44): run-time error JS1195: Expected expression: .
(8051,47-48): run-time error JS1010: Expected identifier: .
(8051,47-48): run-time error JS1195: Expected expression: .
(8130,19-20): run-time error JS1010: Expected identifier: .
(8130,19-20): run-time error JS1195: Expected expression: .
(8131,19-20): run-time error JS1010: Expected identifier: .
(8131,19-20): run-time error JS1195: Expected expression: .
(8132,19-20): run-time error JS1010: Expected identifier: .
(8132,19-20): run-time error JS1195: Expected expression: .
(8134,19-20): run-time error JS1010: Expected identifier: .
(8134,19-20): run-time error JS1195: Expected expression: .
(8135,19-20): run-time error JS1010: Expected identifier: .
(8135,19-20): run-time error JS1195: Expected expression: .
(8136,19-20): run-time error JS1010: Expected identifier: .
(8136,19-20): run-time error JS1195: Expected expression: .
(8138,19-20): run-time error JS1010: Expected identifier: .
(8138,19-20): run-time error JS1195: Expected expression: .
(8139,19-20): run-time error JS1010: Expected identifier: .
(8139,19-20): run-time error JS1195: Expected expression: .
(8140,19-20): run-time error JS1010: Expected identifier: .
(8140,19-20): run-time error JS1195: Expected expression: .
(8142,19-20): run-time error JS1010: Expected identifier: .
(8142,19-20): run-time error JS1195: Expected expression: .
(8144,19-20): run-time error JS1010: Expected identifier: .
(8144,19-20): run-time error JS1195: Expected expression: .
(8145,19-20): run-time error JS1010: Expected identifier: .
(8145,19-20): run-time error JS1195: Expected expression: .
(8146,19-20): run-time error JS1010: Expected identifier: .
(8146,19-20): run-time error JS1195: Expected expression: .
(8147,19-20): run-time error JS1010: Expected identifier: .
(8147,19-20): run-time error JS1195: Expected expression: .
(8149,19-20): run-time error JS1010: Expected identifier: .
(8149,19-20): run-time error JS1195: Expected expression: .
(8151,19-20): run-time error JS1010: Expected identifier: .
(8151,19-20): run-time error JS1195: Expected expression: .
(8152,19-20): run-time error JS1010: Expected identifier: .
(8152,19-20): run-time error JS1195: Expected expression: .
(8153,19-20): run-time error JS1010: Expected identifier: .
(8153,19-20): run-time error JS1195: Expected expression: .
(8154,19-20): run-time error JS1010: Expected identifier: .
(8154,19-20): run-time error JS1195: Expected expression: .
(8249,27-28): run-time error JS1010: Expected identifier: .
(8249,27-28): run-time error JS1195: Expected expression: .
(8385,27-28): run-time error JS1010: Expected identifier: .
(8385,27-28): run-time error JS1195: Expected expression: .
(8386,27-28): run-time error JS1010: Expected identifier: .
(8386,27-28): run-time error JS1195: Expected expression: .
(8389,31-32): run-time error JS1010: Expected identifier: .
(8389,31-32): run-time error JS1195: Expected expression: .
(8390,31-32): run-time error JS1010: Expected identifier: .
(8390,31-32): run-time error JS1195: Expected expression: .
(8393,35-36): run-time error JS1010: Expected identifier: .
(8393,35-36): run-time error JS1195: Expected expression: .
(8394,35-36): run-time error JS1010: Expected identifier: .
(8394,35-36): run-time error JS1195: Expected expression: .
(8397,39-40): run-time error JS1010: Expected identifier: .
(8397,39-40): run-time error JS1195: Expected expression: .
(8398,39-40): run-time error JS1010: Expected identifier: .
(8398,39-40): run-time error JS1195: Expected expression: .
(8408,23-24): run-time error JS1010: Expected identifier: .
(8408,23-24): run-time error JS1195: Expected expression: .
(8431,27-28): run-time error JS1010: Expected identifier: .
(8431,27-28): run-time error JS1195: Expected expression: .
(8434,23-24): run-time error JS1010: Expected identifier: .
(8434,23-24): run-time error JS1195: Expected expression: .
(8461,27-28): run-time error JS1010: Expected identifier: .
(8461,27-28): run-time error JS1195: Expected expression: .
(8464,23-24): run-time error JS1010: Expected identifier: .
(8464,23-24): run-time error JS1195: Expected expression: .
(8486,27-28): run-time error JS1010: Expected identifier: .
(8486,27-28): run-time error JS1195: Expected expression: .
(8489,23-24): run-time error JS1010: Expected identifier: .
(8489,23-24): run-time error JS1195: Expected expression: .
(8553,27-28): run-time error JS1010: Expected identifier: .
(8553,27-28): run-time error JS1195: Expected expression: .
(8569,27-28): run-time error JS1010: Expected identifier: .
(8569,27-28): run-time error JS1195: Expected expression: .
(8582,27-28): run-time error JS1010: Expected identifier: .
(8582,27-28): run-time error JS1195: Expected expression: .
(8624,31-32): run-time error JS1010: Expected identifier: .
(8624,31-32): run-time error JS1195: Expected expression: .
(8641,31-32): run-time error JS1010: Expected identifier: .
(8641,31-32): run-time error JS1195: Expected expression: .
(8651,23-24): run-time error JS1010: Expected identifier: .
(8651,23-24): run-time error JS1195: Expected expression: .
(8657,23-24): run-time error JS1010: Expected identifier: .
(8657,23-24): run-time error JS1195: Expected expression: .
(8658,23-24): run-time error JS1010: Expected identifier: .
(8658,23-24): run-time error JS1195: Expected expression: .
(8664,23-24): run-time error JS1010: Expected identifier: .
(8664,23-24): run-time error JS1195: Expected expression: .
(8665,23-24): run-time error JS1010: Expected identifier: .
(8665,23-24): run-time error JS1195: Expected expression: .
(8671,23-24): run-time error JS1010: Expected identifier: .
(8671,23-24): run-time error JS1195: Expected expression: .
(8677,23-24): run-time error JS1010: Expected identifier: .
(8677,23-24): run-time error JS1195: Expected expression: .
(8681,23-24): run-time error JS1010: Expected identifier: .
(8681,23-24): run-time error JS1195: Expected expression: .
(8682,23-24): run-time error JS1010: Expected identifier: .
(8682,23-24): run-time error JS1195: Expected expression: .
(8683,23-24): run-time error JS1010: Expected identifier: .
(8683,23-24): run-time error JS1195: Expected expression: .
(8684,23-24): run-time error JS1010: Expected identifier: .
(8684,23-24): run-time error JS1195: Expected expression: .
(8685,23-24): run-time error JS1010: Expected identifier: .
(8685,23-24): run-time error JS1195: Expected expression: .
(8686,23-24): run-time error JS1010: Expected identifier: .
(8686,23-24): run-time error JS1195: Expected expression: .
(8687,23-24): run-time error JS1010: Expected identifier: .
(8687,23-24): run-time error JS1195: Expected expression: .
(8754,19-20): run-time error JS1010: Expected identifier: .
(8754,19-20): run-time error JS1195: Expected expression: .
(8755,19-20): run-time error JS1010: Expected identifier: .
(8755,19-20): run-time error JS1195: Expected expression: .
(8756,19-20): run-time error JS1010: Expected identifier: .
(8756,19-20): run-time error JS1195: Expected expression: .
(8758,19-20): run-time error JS1010: Expected identifier: .
(8758,19-20): run-time error JS1195: Expected expression: .
(8759,19-20): run-time error JS1010: Expected identifier: .
(8759,19-20): run-time error JS1195: Expected expression: .
(8760,19-20): run-time error JS1010: Expected identifier: .
(8760,19-20): run-time error JS1195: Expected expression: .
(8762,19-20): run-time error JS1010: Expected identifier: .
(8762,19-20): run-time error JS1195: Expected expression: .
(8763,19-20): run-time error JS1010: Expected identifier: .
(8763,19-20): run-time error JS1195: Expected expression: .
(8764,19-20): run-time error JS1010: Expected identifier: .
(8764,19-20): run-time error JS1195: Expected expression: .
(8766,19-20): run-time error JS1010: Expected identifier: .
(8766,19-20): run-time error JS1195: Expected expression: .
(8768,19-20): run-time error JS1010: Expected identifier: .
(8768,19-20): run-time error JS1195: Expected expression: .
(8769,19-20): run-time error JS1010: Expected identifier: .
(8769,19-20): run-time error JS1195: Expected expression: .
(8770,19-20): run-time error JS1010: Expected identifier: .
(8770,19-20): run-time error JS1195: Expected expression: .
(8771,19-20): run-time error JS1010: Expected identifier: .
(8771,19-20): run-time error JS1195: Expected expression: .
(8773,19-20): run-time error JS1010: Expected identifier: .
(8773,19-20): run-time error JS1195: Expected expression: .
(8775,19-20): run-time error JS1010: Expected identifier: .
(8775,19-20): run-time error JS1195: Expected expression: .
(8776,19-20): run-time error JS1010: Expected identifier: .
(8776,19-20): run-time error JS1195: Expected expression: .
(8777,19-20): run-time error JS1010: Expected identifier: .
(8777,19-20): run-time error JS1195: Expected expression: .
(8778,19-20): run-time error JS1010: Expected identifier: .
(8778,19-20): run-time error JS1195: Expected expression: .
(8880,27-28): run-time error JS1010: Expected identifier: .
(8880,27-28): run-time error JS1195: Expected expression: .
(9016,27-28): run-time error JS1010: Expected identifier: .
(9016,27-28): run-time error JS1195: Expected expression: .
(9017,27-28): run-time error JS1010: Expected identifier: .
(9017,27-28): run-time error JS1195: Expected expression: .
(9020,31-32): run-time error JS1010: Expected identifier: .
(9020,31-32): run-time error JS1195: Expected expression: .
(9021,31-32): run-time error JS1010: Expected identifier: .
(9021,31-32): run-time error JS1195: Expected expression: .
(9024,35-36): run-time error JS1010: Expected identifier: .
(9024,35-36): run-time error JS1195: Expected expression: .
(9025,35-36): run-time error JS1010: Expected identifier: .
(9025,35-36): run-time error JS1195: Expected expression: .
(9028,39-40): run-time error JS1010: Expected identifier: .
(9028,39-40): run-time error JS1195: Expected expression: .
(9029,39-40): run-time error JS1010: Expected identifier: .
(9029,39-40): run-time error JS1195: Expected expression: .
(9039,23-24): run-time error JS1010: Expected identifier: .
(9039,23-24): run-time error JS1195: Expected expression: .
(9062,27-28): run-time error JS1010: Expected identifier: .
(9062,27-28): run-time error JS1195: Expected expression: .
(9065,23-24): run-time error JS1010: Expected identifier: .
(9065,23-24): run-time error JS1195: Expected expression: .
(9086,27-28): run-time error JS1010: Expected identifier: .
(9086,27-28): run-time error JS1195: Expected expression: .
(9089,23-24): run-time error JS1010: Expected identifier: .
(9089,23-24): run-time error JS1195: Expected expression: .
(9111,27-28): run-time error JS1010: Expected identifier: .
(9111,27-28): run-time error JS1195: Expected expression: .
(9114,23-24): run-time error JS1010: Expected identifier: .
(9114,23-24): run-time error JS1195: Expected expression: .
(9175,27-28): run-time error JS1010: Expected identifier: .
(9175,27-28): run-time error JS1195: Expected expression: .
(9188,27-28): run-time error JS1010: Expected identifier: .
(9188,27-28): run-time error JS1195: Expected expression: .
(9200,27-28): run-time error JS1010: Expected identifier: .
(9200,27-28): run-time error JS1195: Expected expression: .
(9242,31-32): run-time error JS1010: Expected identifier: .
(9242,31-32): run-time error JS1195: Expected expression: .
(9259,31-32): run-time error JS1010: Expected identifier: .
(9259,31-32): run-time error JS1195: Expected expression: .
(9269,23-24): run-time error JS1010: Expected identifier: .
(9269,23-24): run-time error JS1195: Expected expression: .
(9270,23-24): run-time error JS1010: Expected identifier: .
(9270,23-24): run-time error JS1195: Expected expression: .
(9276,23-24): run-time error JS1010: Expected identifier: .
(9276,23-24): run-time error JS1195: Expected expression: .
(9282,23-24): run-time error JS1010: Expected identifier: .
(9282,23-24): run-time error JS1195: Expected expression: .
(9283,23-24): run-time error JS1010: Expected identifier: .
(9283,23-24): run-time error JS1195: Expected expression: .
(9289,23-24): run-time error JS1010: Expected identifier: .
(9289,23-24): run-time error JS1195: Expected expression: .
(9295,23-24): run-time error JS1010: Expected identifier: .
(9295,23-24): run-time error JS1195: Expected expression: .
(9299,23-24): run-time error JS1010: Expected identifier: .
(9299,23-24): run-time error JS1195: Expected expression: .
(9300,23-24): run-time error JS1010: Expected identifier: .
(9300,23-24): run-time error JS1195: Expected expression: .
(9301,23-24): run-time error JS1010: Expected identifier: .
(9301,23-24): run-time error JS1195: Expected expression: .
(9302,23-24): run-time error JS1010: Expected identifier: .
(9302,23-24): run-time error JS1195: Expected expression: .
(9303,23-24): run-time error JS1010: Expected identifier: .
(9303,23-24): run-time error JS1195: Expected expression: .
(9304,23-24): run-time error JS1010: Expected identifier: .
(9304,23-24): run-time error JS1195: Expected expression: .
(9305,23-24): run-time error JS1010: Expected identifier: .
(9305,23-24): run-time error JS1195: Expected expression: .
(9359,19-20): run-time error JS1010: Expected identifier: .
(9359,19-20): run-time error JS1195: Expected expression: .
(9360,19-20): run-time error JS1010: Expected identifier: .
(9360,19-20): run-time error JS1195: Expected expression: .
(9362,19-20): run-time error JS1010: Expected identifier: .
(9362,19-20): run-time error JS1195: Expected expression: .
(9363,19-20): run-time error JS1010: Expected identifier: .
(9363,19-20): run-time error JS1195: Expected expression: .
(9364,19-20): run-time error JS1010: Expected identifier: .
(9364,19-20): run-time error JS1195: Expected expression: .
(9366,19-20): run-time error JS1010: Expected identifier: .
(9366,19-20): run-time error JS1195: Expected expression: .
(9367,19-20): run-time error JS1010: Expected identifier: .
(9367,19-20): run-time error JS1195: Expected expression: .
(9368,19-20): run-time error JS1010: Expected identifier: .
(9368,19-20): run-time error JS1195: Expected expression: .
(9370,19-20): run-time error JS1010: Expected identifier: .
(9370,19-20): run-time error JS1195: Expected expression: .
(9372,19-20): run-time error JS1010: Expected identifier: .
(9372,19-20): run-time error JS1195: Expected expression: .
(9374,19-20): run-time error JS1010: Expected identifier: .
(9374,19-20): run-time error JS1195: Expected expression: .
(9375,19-20): run-time error JS1010: Expected identifier: .
(9375,19-20): run-time error JS1195: Expected expression: .
(9468,23-24): run-time error JS1010: Expected identifier: .
(9468,23-24): run-time error JS1195: Expected expression: .
(9469,23-24): run-time error JS1010: Expected identifier: .
(9469,23-24): run-time error JS1195: Expected expression: .
(9502,27-28): run-time error JS1010: Expected identifier: .
(9502,27-28): run-time error JS1195: Expected expression: .
(9527,27-28): run-time error JS1010: Expected identifier: .
(9527,27-28): run-time error JS1195: Expected expression: .
(9530,23-24): run-time error JS1010: Expected identifier: .
(9530,23-24): run-time error JS1195: Expected expression: .
(9555,27-28): run-time error JS1010: Expected identifier: .
(9555,27-28): run-time error JS1195: Expected expression: .
(9558,23-24): run-time error JS1010: Expected identifier: .
(9558,23-24): run-time error JS1195: Expected expression: .
(9564,23-24): run-time error JS1010: Expected identifier: .
(9564,23-24): run-time error JS1195: Expected expression: .
(9570,23-24): run-time error JS1010: Expected identifier: .
(9570,23-24): run-time error JS1195: Expected expression: .
(9571,23-24): run-time error JS1010: Expected identifier: .
(9571,23-24): run-time error JS1195: Expected expression: .
(9577,23-24): run-time error JS1010: Expected identifier: .
(9577,23-24): run-time error JS1195: Expected expression: .
(9578,23-24): run-time error JS1010: Expected identifier: .
(9578,23-24): run-time error JS1195: Expected expression: .
(9584,23-24): run-time error JS1010: Expected identifier: .
(9584,23-24): run-time error JS1195: Expected expression: .
(9585,23-24): run-time error JS1010: Expected identifier: .
(9585,23-24): run-time error JS1195: Expected expression: .
(9589,23-24): run-time error JS1010: Expected identifier: .
(9589,23-24): run-time error JS1195: Expected expression: .
(9594,23-24): run-time error JS1010: Expected identifier: .
(9594,23-24): run-time error JS1195: Expected expression: .
(9601,23-24): run-time error JS1010: Expected identifier: .
(9601,23-24): run-time error JS1195: Expected expression: .
(9604,23-24): run-time error JS1010: Expected identifier: .
(9604,23-24): run-time error JS1195: Expected expression: .
(9703,23-24): run-time error JS1010: Expected identifier: .
(9703,23-24): run-time error JS1195: Expected expression: .
(9704,23-24): run-time error JS1010: Expected identifier: .
(9704,23-24): run-time error JS1195: Expected expression: .
(9739,19-20): run-time error JS1010: Expected identifier: .
(9739,19-20): run-time error JS1195: Expected expression: .
(9740,19-20): run-time error JS1010: Expected identifier: .
(9740,19-20): run-time error JS1195: Expected expression: .
(9741,19-20): run-time error JS1010: Expected identifier: .
(9741,19-20): run-time error JS1195: Expected expression: .
(9743,19-20): run-time error JS1010: Expected identifier: .
(9743,19-20): run-time error JS1195: Expected expression: .
(9744,19-20): run-time error JS1010: Expected identifier: .
(9744,19-20): run-time error JS1195: Expected expression: .
(9745,19-20): run-time error JS1010: Expected identifier: .
(9745,19-20): run-time error JS1195: Expected expression: .
(9747,19-20): run-time error JS1010: Expected identifier: .
(9747,19-20): run-time error JS1195: Expected expression: .
(9858,23-24): run-time error JS1010: Expected identifier: .
(9858,23-24): run-time error JS1195: Expected expression: .
(9899,23-24): run-time error JS1010: Expected identifier: .
(9899,23-24): run-time error JS1195: Expected expression: .
(9924,23-24): run-time error JS1010: Expected identifier: .
(9924,23-24): run-time error JS1195: Expected expression: .
(9942,39-40): run-time error JS1010: Expected identifier: .
(9942,39-40): run-time error JS1195: Expected expression: .
(9943,39-40): run-time error JS1010: Expected identifier: .
(9943,39-40): run-time error JS1195: Expected expression: .
(9969,23-24): run-time error JS1010: Expected identifier: .
(9969,23-24): run-time error JS1195: Expected expression: .
(9972,23-24): run-time error JS1010: Expected identifier: .
(9972,23-24): run-time error JS1195: Expected expression: .
(9977,27-28): run-time error JS1010: Expected identifier: .
(9977,27-28): run-time error JS1195: Expected expression: .
(9984,23-24): run-time error JS1010: Expected identifier: .
(9984,23-24): run-time error JS1195: Expected expression: .
(9987,23-24): run-time error JS1010: Expected identifier: .
(9987,23-24): run-time error JS1195: Expected expression: .
(9990,27-28): run-time error JS1010: Expected identifier: .
(9990,27-28): run-time error JS1195: Expected expression: .
(9999,23-24): run-time error JS1010: Expected identifier: .
(9999,23-24): run-time error JS1195: Expected expression: .
(10079,19-20): run-time error JS1010: Expected identifier: .
(10079,19-20): run-time error JS1195: Expected expression: .
(10080,19-20): run-time error JS1010: Expected identifier: .
(10080,19-20): run-time error JS1195: Expected expression: .
(10081,19-20): run-time error JS1010: Expected identifier: .
(10081,19-20): run-time error JS1195: Expected expression: .
(10083,19-20): run-time error JS1010: Expected identifier: .
(10083,19-20): run-time error JS1195: Expected expression: .
(10084,19-20): run-time error JS1010: Expected identifier: .
(10084,19-20): run-time error JS1195: Expected expression: .
(10085,19-20): run-time error JS1010: Expected identifier: .
(10085,19-20): run-time error JS1195: Expected expression: .
(10087,19-20): run-time error JS1010: Expected identifier: .
(10087,19-20): run-time error JS1195: Expected expression: .
(10182,23-24): run-time error JS1010: Expected identifier: .
(10182,23-24): run-time error JS1195: Expected expression: .
(10207,23-24): run-time error JS1010: Expected identifier: .
(10207,23-24): run-time error JS1195: Expected expression: .
(10225,39-40): run-time error JS1010: Expected identifier: .
(10225,39-40): run-time error JS1195: Expected expression: .
(10226,39-40): run-time error JS1010: Expected identifier: .
(10226,39-40): run-time error JS1195: Expected expression: .
(10252,23-24): run-time error JS1010: Expected identifier: .
(10252,23-24): run-time error JS1195: Expected expression: .
(10255,23-24): run-time error JS1010: Expected identifier: .
(10255,23-24): run-time error JS1195: Expected expression: .
(10259,27-28): run-time error JS1010: Expected identifier: .
(10259,27-28): run-time error JS1195: Expected expression: .
(10268,23-24): run-time error JS1010: Expected identifier: .
(10268,23-24): run-time error JS1195: Expected expression: .
(10271,23-24): run-time error JS1010: Expected identifier: .
(10271,23-24): run-time error JS1195: Expected expression: .
(10274,27-28): run-time error JS1010: Expected identifier: .
(10274,27-28): run-time error JS1195: Expected expression: .
(10283,23-24): run-time error JS1010: Expected identifier: .
(10283,23-24): run-time error JS1195: Expected expression: .
(10309,19-20): run-time error JS1010: Expected identifier: .
(10309,19-20): run-time error JS1195: Expected expression: .
(10310,19-20): run-time error JS1010: Expected identifier: .
(10310,19-20): run-time error JS1195: Expected expression: .
(10311,19-20): run-time error JS1010: Expected identifier: .
(10311,19-20): run-time error JS1195: Expected expression: .
(10312,19-20): run-time error JS1010: Expected identifier: .
(10312,19-20): run-time error JS1195: Expected expression: .
(10314,19-20): run-time error JS1010: Expected identifier: .
(10314,19-20): run-time error JS1195: Expected expression: .
(10315,19-20): run-time error JS1010: Expected identifier: .
(10315,19-20): run-time error JS1195: Expected expression: .
(10317,19-20): run-time error JS1010: Expected identifier: .
(10317,19-20): run-time error JS1195: Expected expression: .
(10318,19-20): run-time error JS1010: Expected identifier: .
(10318,19-20): run-time error JS1195: Expected expression: .
(10319,19-20): run-time error JS1010: Expected identifier: .
(10319,19-20): run-time error JS1195: Expected expression: .
(10321,19-20): run-time error JS1010: Expected identifier: .
(10321,19-20): run-time error JS1195: Expected expression: .
(10335,19-20): run-time error JS1010: Expected identifier: .
(10335,19-20): run-time error JS1195: Expected expression: .
(10342,19-20): run-time error JS1010: Expected identifier: .
(10342,19-20): run-time error JS1195: Expected expression: .
(10353,19-20): run-time error JS1010: Expected identifier: .
(10353,19-20): run-time error JS1195: Expected expression: .
(10354,19-20): run-time error JS1010: Expected identifier: .
(10354,19-20): run-time error JS1195: Expected expression: .
(10358,19-20): run-time error JS1010: Expected identifier: .
(10358,19-20): run-time error JS1195: Expected expression: .
(10363,23-24): run-time error JS1010: Expected identifier: .
(10363,23-24): run-time error JS1195: Expected expression: .
(10379,19-20): run-time error JS1010: Expected identifier: .
(10379,19-20): run-time error JS1195: Expected expression: .
(10390,19-20): run-time error JS1010: Expected identifier: .
(10390,19-20): run-time error JS1195: Expected expression: .
(10392,19-20): run-time error JS1010: Expected identifier: .
(10392,19-20): run-time error JS1195: Expected expression: .
(10426,23-24): run-time error JS1010: Expected identifier: .
(10426,23-24): run-time error JS1195: Expected expression: .
(10430,27-28): run-time error JS1010: Expected identifier: .
(10430,27-28): run-time error JS1195: Expected expression: .
(10438,27-28): run-time error JS1010: Expected identifier: .
(10438,27-28): run-time error JS1195: Expected expression: .
(10441,23-24): run-time error JS1010: Expected identifier: .
(10441,23-24): run-time error JS1195: Expected expression: .
(10443,23-24): run-time error JS1010: Expected identifier: .
(10443,23-24): run-time error JS1195: Expected expression: .
(10506,19-20): run-time error JS1010: Expected identifier: .
(10506,19-20): run-time error JS1195: Expected expression: .
(10507,19-20): run-time error JS1010: Expected identifier: .
(10507,19-20): run-time error JS1195: Expected expression: .
(10508,19-20): run-time error JS1010: Expected identifier: .
(10508,19-20): run-time error JS1195: Expected expression: .
(10510,19-20): run-time error JS1010: Expected identifier: .
(10510,19-20): run-time error JS1195: Expected expression: .
(10511,19-20): run-time error JS1010: Expected identifier: .
(10511,19-20): run-time error JS1195: Expected expression: .
(10512,19-20): run-time error JS1010: Expected identifier: .
(10512,19-20): run-time error JS1195: Expected expression: .
(10514,19-20): run-time error JS1010: Expected identifier: .
(10514,19-20): run-time error JS1195: Expected expression: .
(10515,19-20): run-time error JS1010: Expected identifier: .
(10515,19-20): run-time error JS1195: Expected expression: .
(10516,19-20): run-time error JS1010: Expected identifier: .
(10516,19-20): run-time error JS1195: Expected expression: .
(10518,19-20): run-time error JS1010: Expected identifier: .
(10518,19-20): run-time error JS1195: Expected expression: .
(10520,19-20): run-time error JS1010: Expected identifier: .
(10520,19-20): run-time error JS1195: Expected expression: .
(10521,19-20): run-time error JS1010: Expected identifier: .
(10521,19-20): run-time error JS1195: Expected expression: .
(10522,19-20): run-time error JS1010: Expected identifier: .
(10522,19-20): run-time error JS1195: Expected expression: .
(10523,19-20): run-time error JS1010: Expected identifier: .
(10523,19-20): run-time error JS1195: Expected expression: .
(10525,19-20): run-time error JS1010: Expected identifier: .
(10525,19-20): run-time error JS1195: Expected expression: .
(10526,19-20): run-time error JS1010: Expected identifier: .
(10526,19-20): run-time error JS1195: Expected expression: .
(10527,19-20): run-time error JS1010: Expected identifier: .
(10527,19-20): run-time error JS1195: Expected expression: .
(10529,19-20): run-time error JS1010: Expected identifier: .
(10529,19-20): run-time error JS1195: Expected expression: .
(10530,19-20): run-time error JS1010: Expected identifier: .
(10530,19-20): run-time error JS1195: Expected expression: .
(10532,19-20): run-time error JS1010: Expected identifier: .
(10532,19-20): run-time error JS1195: Expected expression: .
(10633,27-28): run-time error JS1010: Expected identifier: .
(10633,27-28): run-time error JS1195: Expected expression: .
(10827,27-28): run-time error JS1010: Expected identifier: .
(10827,27-28): run-time error JS1195: Expected expression: .
(10828,27-28): run-time error JS1010: Expected identifier: .
(10828,27-28): run-time error JS1195: Expected expression: .
(10831,31-32): run-time error JS1010: Expected identifier: .
(10831,31-32): run-time error JS1195: Expected expression: .
(10832,31-32): run-time error JS1010: Expected identifier: .
(10832,31-32): run-time error JS1195: Expected expression: .
(10835,35-36): run-time error JS1010: Expected identifier: .
(10835,35-36): run-time error JS1195: Expected expression: .
(10836,35-36): run-time error JS1010: Expected identifier: .
(10836,35-36): run-time error JS1195: Expected expression: .
(10839,39-40): run-time error JS1010: Expected identifier: .
(10839,39-40): run-time error JS1195: Expected expression: .
(10840,39-40): run-time error JS1010: Expected identifier: .
(10840,39-40): run-time error JS1195: Expected expression: .
(10843,43-44): run-time error JS1010: Expected identifier: .
(10843,43-44): run-time error JS1195: Expected expression: .
(10844,43-44): run-time error JS1010: Expected identifier: .
(10844,43-44): run-time error JS1195: Expected expression: .
(10855,23-24): run-time error JS1010: Expected identifier: .
(10855,23-24): run-time error JS1195: Expected expression: .
(10878,27-28): run-time error JS1010: Expected identifier: .
(10878,27-28): run-time error JS1195: Expected expression: .
(10881,23-24): run-time error JS1010: Expected identifier: .
(10881,23-24): run-time error JS1195: Expected expression: .
(10904,27-28): run-time error JS1010: Expected identifier: .
(10904,27-28): run-time error JS1195: Expected expression: .
(10907,23-24): run-time error JS1010: Expected identifier: .
(10907,23-24): run-time error JS1195: Expected expression: .
(10929,27-28): run-time error JS1010: Expected identifier: .
(10929,27-28): run-time error JS1195: Expected expression: .
(10932,23-24): run-time error JS1010: Expected identifier: .
(10932,23-24): run-time error JS1195: Expected expression: .
(10949,27-28): run-time error JS1010: Expected identifier: .
(10949,27-28): run-time error JS1195: Expected expression: .
(10952,23-24): run-time error JS1010: Expected identifier: .
(10952,23-24): run-time error JS1195: Expected expression: .
(10953,23-24): run-time error JS1010: Expected identifier: .
(10953,23-24): run-time error JS1195: Expected expression: .
(10987,23-24): run-time error JS1010: Expected identifier: .
(10987,23-24): run-time error JS1195: Expected expression: .
(10996,23-24): run-time error JS1010: Expected identifier: .
(10996,23-24): run-time error JS1195: Expected expression: .
(11002,23-24): run-time error JS1010: Expected identifier: .
(11002,23-24): run-time error JS1195: Expected expression: .
(11003,23-24): run-time error JS1010: Expected identifier: .
(11003,23-24): run-time error JS1195: Expected expression: .
(11009,23-24): run-time error JS1010: Expected identifier: .
(11009,23-24): run-time error JS1195: Expected expression: .
(11010,23-24): run-time error JS1010: Expected identifier: .
(11010,23-24): run-time error JS1195: Expected expression: .
(11016,23-24): run-time error JS1010: Expected identifier: .
(11016,23-24): run-time error JS1195: Expected expression: .
(11019,23-24): run-time error JS1010: Expected identifier: .
(11019,23-24): run-time error JS1195: Expected expression: .
(11023,23-24): run-time error JS1010: Expected identifier: .
(11023,23-24): run-time error JS1195: Expected expression: .
(11027,23-24): run-time error JS1010: Expected identifier: .
(11027,23-24): run-time error JS1195: Expected expression: .
(11028,23-24): run-time error JS1010: Expected identifier: .
(11028,23-24): run-time error JS1195: Expected expression: .
(11029,23-24): run-time error JS1010: Expected identifier: .
(11029,23-24): run-time error JS1195: Expected expression: .
(11030,23-24): run-time error JS1010: Expected identifier: .
(11030,23-24): run-time error JS1195: Expected expression: .
(11031,23-24): run-time error JS1010: Expected identifier: .
(11031,23-24): run-time error JS1195: Expected expression: .
(11032,23-24): run-time error JS1010: Expected identifier: .
(11032,23-24): run-time error JS1195: Expected expression: .
(11033,23-24): run-time error JS1010: Expected identifier: .
(11033,23-24): run-time error JS1195: Expected expression: .
(11107,19-20): run-time error JS1010: Expected identifier: .
(11107,19-20): run-time error JS1195: Expected expression: .
(11108,19-20): run-time error JS1010: Expected identifier: .
(11108,19-20): run-time error JS1195: Expected expression: .
(11109,19-20): run-time error JS1010: Expected identifier: .
(11109,19-20): run-time error JS1195: Expected expression: .
(11111,19-20): run-time error JS1010: Expected identifier: .
(11111,19-20): run-time error JS1195: Expected expression: .
(11112,19-20): run-time error JS1010: Expected identifier: .
(11112,19-20): run-time error JS1195: Expected expression: .
(11113,19-20): run-time error JS1010: Expected identifier: .
(11113,19-20): run-time error JS1195: Expected expression: .
(11115,19-20): run-time error JS1010: Expected identifier: .
(11115,19-20): run-time error JS1195: Expected expression: .
(11116,19-20): run-time error JS1010: Expected identifier: .
(11116,19-20): run-time error JS1195: Expected expression: .
(11117,19-20): run-time error JS1010: Expected identifier: .
(11117,19-20): run-time error JS1195: Expected expression: .
(11119,19-20): run-time error JS1010: Expected identifier: .
(11119,19-20): run-time error JS1195: Expected expression: .
(11120,19-20): run-time error JS1010: Expected identifier: .
(11120,19-20): run-time error JS1195: Expected expression: .
(11121,19-20): run-time error JS1010: Expected identifier: .
(11121,19-20): run-time error JS1195: Expected expression: .
(11123,19-20): run-time error JS1010: Expected identifier: .
(11123,19-20): run-time error JS1195: Expected expression: .
(11124,19-20): run-time error JS1010: Expected identifier: .
(11124,19-20): run-time error JS1195: Expected expression: .
(11125,19-20): run-time error JS1010: Expected identifier: .
(11125,19-20): run-time error JS1195: Expected expression: .
(11126,19-20): run-time error JS1010: Expected identifier: .
(11126,19-20): run-time error JS1195: Expected expression: .
(11128,19-20): run-time error JS1010: Expected identifier: .
(11128,19-20): run-time error JS1195: Expected expression: .
(11129,19-20): run-time error JS1010: Expected identifier: .
(11129,19-20): run-time error JS1195: Expected expression: .
(11130,19-20): run-time error JS1010: Expected identifier: .
(11130,19-20): run-time error JS1195: Expected expression: .
(11132,19-20): run-time error JS1010: Expected identifier: .
(11132,19-20): run-time error JS1195: Expected expression: .
(11133,19-20): run-time error JS1010: Expected identifier: .
(11133,19-20): run-time error JS1195: Expected expression: .
(11135,19-20): run-time error JS1010: Expected identifier: .
(11135,19-20): run-time error JS1195: Expected expression: .
(11240,27-28): run-time error JS1010: Expected identifier: .
(11240,27-28): run-time error JS1195: Expected expression: .
(11436,27-28): run-time error JS1010: Expected identifier: .
(11436,27-28): run-time error JS1195: Expected expression: .
(11437,27-28): run-time error JS1010: Expected identifier: .
(11437,27-28): run-time error JS1195: Expected expression: .
(11440,31-32): run-time error JS1010: Expected identifier: .
(11440,31-32): run-time error JS1195: Expected expression: .
(11441,31-32): run-time error JS1010: Expected identifier: .
(11441,31-32): run-time error JS1195: Expected expression: .
(11444,35-36): run-time error JS1010: Expected identifier: .
(11444,35-36): run-time error JS1195: Expected expression: .
(11445,35-36): run-time error JS1010: Expected identifier: .
(11445,35-36): run-time error JS1195: Expected expression: .
(11448,39-40): run-time error JS1010: Expected identifier: .
(11448,39-40): run-time error JS1195: Expected expression: .
(11449,39-40): run-time error JS1010: Expected identifier: .
(11449,39-40): run-time error JS1195: Expected expression: .
(11452,43-44): run-time error JS1010: Expected identifier: .
(11452,43-44): run-time error JS1195: Expected expression: .
(11453,43-44): run-time error JS1010: Expected identifier: .
(11453,43-44): run-time error JS1195: Expected expression: .
(11464,23-24): run-time error JS1010: Expected identifier: .
(11464,23-24): run-time error JS1195: Expected expression: .
(11487,27-28): run-time error JS1010: Expected identifier: .
(11487,27-28): run-time error JS1195: Expected expression: .
(11490,23-24): run-time error JS1010: Expected identifier: .
(11490,23-24): run-time error JS1195: Expected expression: .
(11514,27-28): run-time error JS1010: Expected identifier: .
(11514,27-28): run-time error JS1195: Expected expression: .
(11517,23-24): run-time error JS1010: Expected identifier: .
(11517,23-24): run-time error JS1195: Expected expression: .
(11539,27-28): run-time error JS1010: Expected identifier: .
(11539,27-28): run-time error JS1195: Expected expression: .
(11542,23-24): run-time error JS1010: Expected identifier: .
(11542,23-24): run-time error JS1195: Expected expression: .
(11559,27-28): run-time error JS1010: Expected identifier: .
(11559,27-28): run-time error JS1195: Expected expression: .
(11562,23-24): run-time error JS1010: Expected identifier: .
(11562,23-24): run-time error JS1195: Expected expression: .
(11563,23-24): run-time error JS1010: Expected identifier: .
(11563,23-24): run-time error JS1195: Expected expression: .
(11585,23-24): run-time error JS1010: Expected identifier: .
(11585,23-24): run-time error JS1195: Expected expression: .
(11594,23-24): run-time error JS1010: Expected identifier: .
(11594,23-24): run-time error JS1195: Expected expression: .
(11600,23-24): run-time error JS1010: Expected identifier: .
(11600,23-24): run-time error JS1195: Expected expression: .
(11601,23-24): run-time error JS1010: Expected identifier: .
(11601,23-24): run-time error JS1195: Expected expression: .
(11607,23-24): run-time error JS1010: Expected identifier: .
(11607,23-24): run-time error JS1195: Expected expression: .
(11608,23-24): run-time error JS1010: Expected identifier: .
(11608,23-24): run-time error JS1195: Expected expression: .
(11614,23-24): run-time error JS1010: Expected identifier: .
(11614,23-24): run-time error JS1195: Expected expression: .
(11617,23-24): run-time error JS1010: Expected identifier: .
(11617,23-24): run-time error JS1195: Expected expression: .
(11621,23-24): run-time error JS1010: Expected identifier: .
(11621,23-24): run-time error JS1195: Expected expression: .
(11625,23-24): run-time error JS1010: Expected identifier: .
(11625,23-24): run-time error JS1195: Expected expression: .
(11626,23-24): run-time error JS1010: Expected identifier: .
(11626,23-24): run-time error JS1195: Expected expression: .
(11627,23-24): run-time error JS1010: Expected identifier: .
(11627,23-24): run-time error JS1195: Expected expression: .
(11628,23-24): run-time error JS1010: Expected identifier: .
(11628,23-24): run-time error JS1195: Expected expression: .
(11629,23-24): run-time error JS1010: Expected identifier: .
(11629,23-24): run-time error JS1195: Expected expression: .
(11630,23-24): run-time error JS1010: Expected identifier: .
(11630,23-24): run-time error JS1195: Expected expression: .
(11631,23-24): run-time error JS1010: Expected identifier: .
(11631,23-24): run-time error JS1195: Expected expression: .
(11759,19-20): run-time error JS1010: Expected identifier: .
(11759,19-20): run-time error JS1195: Expected expression: .
(11760,19-20): run-time error JS1010: Expected identifier: .
(11760,19-20): run-time error JS1195: Expected expression: .
(11762,19-20): run-time error JS1010: Expected identifier: .
(11762,19-20): run-time error JS1195: Expected expression: .
(11795,19-20): run-time error JS1010: Expected identifier: .
(11795,19-20): run-time error JS1195: Expected expression: .
(11802,19-20): run-time error JS1010: Expected identifier: .
(11802,19-20): run-time error JS1195: Expected expression: .
(11807,23-24): run-time error JS1010: Expected identifier: .
(11807,23-24): run-time error JS1195: Expected expression: .
(11809,23-24): run-time error JS1010: Expected identifier: .
(11809,23-24): run-time error JS1195: Expected expression: .
(11855,19-20): run-time error JS1010: Expected identifier: .
(11855,19-20): run-time error JS1195: Expected expression: .
(11856,19-20): run-time error JS1010: Expected identifier: .
(11856,19-20): run-time error JS1195: Expected expression: .
(11857,19-20): run-time error JS1010: Expected identifier: .
(11857,19-20): run-time error JS1195: Expected expression: .
(11861,19-20): run-time error JS1010: Expected identifier: .
(11861,19-20): run-time error JS1195: Expected expression: .
(11862,19-20): run-time error JS1010: Expected identifier: .
(11862,19-20): run-time error JS1195: Expected expression: .
(11883,23-24): run-time error JS1010: Expected identifier: .
(11883,23-24): run-time error JS1195: Expected expression: .
(11886,23-24): run-time error JS1010: Expected identifier: .
(11886,23-24): run-time error JS1195: Expected expression: .
(11887,23-24): run-time error JS1010: Expected identifier: .
(11887,23-24): run-time error JS1195: Expected expression: .
(11899,23-24): run-time error JS1010: Expected identifier: .
(11899,23-24): run-time error JS1195: Expected expression: .
(11902,23-24): run-time error JS1010: Expected identifier: .
(11902,23-24): run-time error JS1195: Expected expression: .
(11905,23-24): run-time error JS1010: Expected identifier: .
(11905,23-24): run-time error JS1195: Expected expression: .
(11906,23-24): run-time error JS1010: Expected identifier: .
(11906,23-24): run-time error JS1195: Expected expression: .
(11914,19-20): run-time error JS1010: Expected identifier: .
(11914,19-20): run-time error JS1195: Expected expression: .
(11980,19-20): run-time error JS1010: Expected identifier: .
(11980,19-20): run-time error JS1195: Expected expression: .
(11981,19-20): run-time error JS1010: Expected identifier: .
(11981,19-20): run-time error JS1195: Expected expression: .
(11982,19-20): run-time error JS1010: Expected identifier: .
(11982,19-20): run-time error JS1195: Expected expression: .
(11984,19-20): run-time error JS1010: Expected identifier: .
(11984,19-20): run-time error JS1195: Expected expression: .
(11985,19-20): run-time error JS1010: Expected identifier: .
(11985,19-20): run-time error JS1195: Expected expression: .
(11986,19-20): run-time error JS1010: Expected identifier: .
(11986,19-20): run-time error JS1195: Expected expression: .
(11992,19-20): run-time error JS1010: Expected identifier: .
(11992,19-20): run-time error JS1195: Expected expression: .
(11993,19-20): run-time error JS1010: Expected identifier: .
(11993,19-20): run-time error JS1195: Expected expression: .
(11994,19-20): run-time error JS1010: Expected identifier: .
(11994,19-20): run-time error JS1195: Expected expression: .
(11995,19-20): run-time error JS1010: Expected identifier: .
(11995,19-20): run-time error JS1195: Expected expression: .
(12006,23-24): run-time error JS1010: Expected identifier: .
(12006,23-24): run-time error JS1195: Expected expression: .
(12007,23-24): run-time error JS1010: Expected identifier: .
(12007,23-24): run-time error JS1195: Expected expression: .
(12017,27-28): run-time error JS1010: Expected identifier: .
(12017,27-28): run-time error JS1195: Expected expression: .
(12019,27-28): run-time error JS1010: Expected identifier: .
(12019,27-28): run-time error JS1195: Expected expression: .
(12032,27-28): run-time error JS1010: Expected identifier: .
(12032,27-28): run-time error JS1195: Expected expression: .
(12034,27-28): run-time error JS1010: Expected identifier: .
(12034,27-28): run-time error JS1195: Expected expression: .
(12043,27-28): run-time error JS1010: Expected identifier: .
(12043,27-28): run-time error JS1195: Expected expression: .
(12044,27-28): run-time error JS1010: Expected identifier: .
(12044,27-28): run-time error JS1195: Expected expression: .
(12050,27-28): run-time error JS1010: Expected identifier: .
(12050,27-28): run-time error JS1195: Expected expression: .
(12057,27-28): run-time error JS1010: Expected identifier: .
(12057,27-28): run-time error JS1195: Expected expression: .
(12071,35-36): run-time error JS1010: Expected identifier: .
(12071,35-36): run-time error JS1195: Expected expression: .
(12081,35-36): run-time error JS1010: Expected identifier: .
(12081,35-36): run-time error JS1195: Expected expression: .
(12191,19-20): run-time error JS1010: Expected identifier: .
(12191,19-20): run-time error JS1195: Expected expression: .
(12193,19-20): run-time error JS1010: Expected identifier: .
(12193,19-20): run-time error JS1195: Expected expression: .
(12195,19-20): run-time error JS1010: Expected identifier: .
(12195,19-20): run-time error JS1195: Expected expression: .
(12198,19-20): run-time error JS1010: Expected identifier: .
(12198,19-20): run-time error JS1195: Expected expression: .
(12205,19-20): run-time error JS1010: Expected identifier: .
(12205,19-20): run-time error JS1195: Expected expression: .
(12211,19-20): run-time error JS1010: Expected identifier: .
(12211,19-20): run-time error JS1195: Expected expression: .
(12219,23-24): run-time error JS1010: Expected identifier: .
(12219,23-24): run-time error JS1195: Expected expression: .
(7113,16,7115,14): run-time error JS1314: Implicit property name must be identifier: function (form, productCategories, productOfferings, stateGuid, subcategoryGuid, transactionTypeName, categoryGuid, productGuid) {
                return "validProductOffering" + form.formId + stateGuid + subcategoryGuid + transactionTypeName + categoryGuid + productGuid;
            }
(7195,16,7197,14): run-time error JS1314: Implicit property name must be identifier: function (form, productCategories, productOfferings, stateGuid, subcategoryGuid, transactionTypeName, categoryGuid, productGuid) {
                return "appliesToSelections" + form.formId + stateGuid + subcategoryGuid + transactionTypeName + categoryGuid + productGuid;
            }
(7195,16,7197,14): run-time error JS1292: Strict-mode does not allow duplicate property names: function (form, productCategories, productOfferings, stateGuid, subcategoryGuid, transactionTypeName, categoryGuid, productGuid) {
                return "appliesToSelections" + form.formId + stateGuid + subcategoryGuid + transactionTypeName + categoryGuid + productGuid;
            }
 */
/* NUGET: BEGIN LICENSE TEXT
 *
 * Microsoft grants you the right to use these script files for the sole
 * purpose of either: (i) interacting through your browser with the Microsoft
 * website or online service, subject to the applicable licensing or use
 * terms; or (ii) using the files as included with a Microsoft product subject
 * to that product's license terms. Microsoft reserves all other rights to the
 * files not expressly granted by Microsoft, whether by implication, estoppel
 * or otherwise. Insofar as a script file is dual licensed under GPL,
 * Microsoft neither took the code under GPL nor distributes it thereunder but
 * under the terms set out in this paragraph. All notices and licenses
 * below are for informational purposes only.
 *
 * NUGET: END LICENSE TEXT */
/*!
 * jQuery Validation Plugin 1.11.1
 *
 * http://bassistance.de/jquery-plugins/jquery-plugin-validation/
 * http://docs.jquery.com/Plugins/Validation
 *
 * Copyright 2013 Jörn Zaefferer
 * Released under the MIT license:
 *   http://www.opensource.org/licenses/mit-license.php
 */

(function($) {

$.extend($.fn, {
	// http://docs.jquery.com/Plugins/Validation/validate
	validate: function( options ) {

		// if nothing is selected, return nothing; can't chain anyway
		if ( !this.length ) {
			if ( options && options.debug && window.console ) {
				console.warn( "Nothing selected, can't validate, returning nothing." );
			}
			return;
		}

		// check if a validator for this form was already created
		var validator = $.data( this[0], "validator" );
		if ( validator ) {
			return validator;
		}

		// Add novalidate tag if HTML5.
		this.attr( "novalidate", "novalidate" );

		validator = new $.validator( options, this[0] );
		$.data( this[0], "validator", validator );

		if ( validator.settings.onsubmit ) {

			this.validateDelegate( ":submit", "click", function( event ) {
				if ( validator.settings.submitHandler ) {
					validator.submitButton = event.target;
				}
				// allow suppressing validation by adding a cancel class to the submit button
				if ( $(event.target).hasClass("cancel") ) {
					validator.cancelSubmit = true;
				}

				// allow suppressing validation by adding the html5 formnovalidate attribute to the submit button
				if ( $(event.target).attr("formnovalidate") !== undefined ) {
					validator.cancelSubmit = true;
				}
			});

			// validate the form on submit
			this.submit( function( event ) {
				if ( validator.settings.debug ) {
					// prevent form submit to be able to see console output
					event.preventDefault();
				}
				function handle() {
					var hidden;
					if ( validator.settings.submitHandler ) {
						if ( validator.submitButton ) {
							// insert a hidden input as a replacement for the missing submit button
							hidden = $("<input type='hidden'/>").attr("name", validator.submitButton.name).val( $(validator.submitButton).val() ).appendTo(validator.currentForm);
						}
						validator.settings.submitHandler.call( validator, validator.currentForm, event );
						if ( validator.submitButton ) {
							// and clean up afterwards; thanks to no-block-scope, hidden can be referenced
							hidden.remove();
						}
						return false;
					}
					return true;
				}

				// prevent submit for invalid forms or custom submit handlers
				if ( validator.cancelSubmit ) {
					validator.cancelSubmit = false;
					return handle();
				}
				if ( validator.form() ) {
					if ( validator.pendingRequest ) {
						validator.formSubmitted = true;
						return false;
					}
					return handle();
				} else {
					validator.focusInvalid();
					return false;
				}
			});
		}

		return validator;
	},
	// http://docs.jquery.com/Plugins/Validation/valid
	valid: function() {
		if ( $(this[0]).is("form")) {
			return this.validate().form();
		} else {
			var valid = true;
			var validator = $(this[0].form).validate();
			this.each(function() {
				valid = valid && validator.element(this);
			});
			return valid;
		}
	},
	// attributes: space seperated list of attributes to retrieve and remove
	removeAttrs: function( attributes ) {
		var result = {},
			$element = this;
		$.each(attributes.split(/\s/), function( index, value ) {
			result[value] = $element.attr(value);
			$element.removeAttr(value);
		});
		return result;
	},
	// http://docs.jquery.com/Plugins/Validation/rules
	rules: function( command, argument ) {
		var element = this[0];

		if ( command ) {
			var settings = $.data(element.form, "validator").settings;
			var staticRules = settings.rules;
			var existingRules = $.validator.staticRules(element);
			switch(command) {
			case "add":
				$.extend(existingRules, $.validator.normalizeRule(argument));
				// remove messages from rules, but allow them to be set separetely
				delete existingRules.messages;
				staticRules[element.name] = existingRules;
				if ( argument.messages ) {
					settings.messages[element.name] = $.extend( settings.messages[element.name], argument.messages );
				}
				break;
			case "remove":
				if ( !argument ) {
					delete staticRules[element.name];
					return existingRules;
				}
				var filtered = {};
				$.each(argument.split(/\s/), function( index, method ) {
					filtered[method] = existingRules[method];
					delete existingRules[method];
				});
				return filtered;
			}
		}

		var data = $.validator.normalizeRules(
		$.extend(
			{},
			$.validator.classRules(element),
			$.validator.attributeRules(element),
			$.validator.dataRules(element),
			$.validator.staticRules(element)
		), element);

		// make sure required is at front
		if ( data.required ) {
			var param = data.required;
			delete data.required;
			data = $.extend({required: param}, data);
		}

		return data;
	}
});

// Custom selectors
$.extend($.expr[":"], {
	// http://docs.jquery.com/Plugins/Validation/blank
	blank: function( a ) { return !$.trim("" + $(a).val()); },
	// http://docs.jquery.com/Plugins/Validation/filled
	filled: function( a ) { return !!$.trim("" + $(a).val()); },
	// http://docs.jquery.com/Plugins/Validation/unchecked
	unchecked: function( a ) { return !$(a).prop("checked"); }
});

// constructor for validator
$.validator = function( options, form ) {
	this.settings = $.extend( true, {}, $.validator.defaults, options );
	this.currentForm = form;
	this.init();
};

$.validator.format = function( source, params ) {
	if ( arguments.length === 1 ) {
		return function() {
			var args = $.makeArray(arguments);
			args.unshift(source);
			return $.validator.format.apply( this, args );
		};
	}
	if ( arguments.length > 2 && params.constructor !== Array  ) {
		params = $.makeArray(arguments).slice(1);
	}
	if ( params.constructor !== Array ) {
		params = [ params ];
	}
	$.each(params, function( i, n ) {
		source = source.replace( new RegExp("\\{" + i + "\\}", "g"), function() {
			return n;
		});
	});
	return source;
};

$.extend($.validator, {

	defaults: {
		messages: {},
		groups: {},
		rules: {},
		errorClass: "error",
		validClass: "valid",
		errorElement: "label",
		focusInvalid: true,
		errorContainer: $([]),
		errorLabelContainer: $([]),
		onsubmit: true,
		ignore: ":hidden",
		ignoreTitle: false,
		onfocusin: function( element, event ) {
			this.lastActive = element;

			// hide error label and remove error class on focus if enabled
			if ( this.settings.focusCleanup && !this.blockFocusCleanup ) {
				if ( this.settings.unhighlight ) {
					this.settings.unhighlight.call( this, element, this.settings.errorClass, this.settings.validClass );
				}
				this.addWrapper(this.errorsFor(element)).hide();
			}
		},
		onfocusout: function( element, event ) {
			if ( !this.checkable(element) && (element.name in this.submitted || !this.optional(element)) ) {
				this.element(element);
			}
		},
		onkeyup: function( element, event ) {
			if ( event.which === 9 && this.elementValue(element) === "" ) {
				return;
			} else if ( element.name in this.submitted || element === this.lastElement ) {
				this.element(element);
			}
		},
		onclick: function( element, event ) {
			// click on selects, radiobuttons and checkboxes
			if ( element.name in this.submitted ) {
				this.element(element);
			}
			// or option elements, check parent select in that case
			else if ( element.parentNode.name in this.submitted ) {
				this.element(element.parentNode);
			}
		},
		highlight: function( element, errorClass, validClass ) {
			if ( element.type === "radio" ) {
				this.findByName(element.name).addClass(errorClass).removeClass(validClass);
			} else {
				$(element).addClass(errorClass).removeClass(validClass);
			}
		},
		unhighlight: function( element, errorClass, validClass ) {
			if ( element.type === "radio" ) {
				this.findByName(element.name).removeClass(errorClass).addClass(validClass);
			} else {
				$(element).removeClass(errorClass).addClass(validClass);
			}
		}
	},

	// http://docs.jquery.com/Plugins/Validation/Validator/setDefaults
	setDefaults: function( settings ) {
		$.extend( $.validator.defaults, settings );
	},

	messages: {
		required: "This field is required.",
		remote: "Please fix this field.",
		email: "Please enter a valid email address.",
		url: "Please enter a valid URL.",
		date: "Please enter a valid date.",
		dateISO: "Please enter a valid date (ISO).",
		number: "Please enter a valid number.",
		digits: "Please enter only digits.",
		creditcard: "Please enter a valid credit card number.",
		equalTo: "Please enter the same value again.",
		maxlength: $.validator.format("Please enter no more than {0} characters."),
		minlength: $.validator.format("Please enter at least {0} characters."),
		rangelength: $.validator.format("Please enter a value between {0} and {1} characters long."),
		range: $.validator.format("Please enter a value between {0} and {1}."),
		max: $.validator.format("Please enter a value less than or equal to {0}."),
		min: $.validator.format("Please enter a value greater than or equal to {0}.")
	},

	autoCreateRanges: false,

	prototype: {

		init: function() {
			this.labelContainer = $(this.settings.errorLabelContainer);
			this.errorContext = this.labelContainer.length && this.labelContainer || $(this.currentForm);
			this.containers = $(this.settings.errorContainer).add( this.settings.errorLabelContainer );
			this.submitted = {};
			this.valueCache = {};
			this.pendingRequest = 0;
			this.pending = {};
			this.invalid = {};
			this.reset();

			var groups = (this.groups = {});
			$.each(this.settings.groups, function( key, value ) {
				if ( typeof value === "string" ) {
					value = value.split(/\s/);
				}
				$.each(value, function( index, name ) {
					groups[name] = key;
				});
			});
			var rules = this.settings.rules;
			$.each(rules, function( key, value ) {
				rules[key] = $.validator.normalizeRule(value);
			});

			function delegate(event) {
				var validator = $.data(this[0].form, "validator"),
					eventType = "on" + event.type.replace(/^validate/, "");
				if ( validator.settings[eventType] ) {
					validator.settings[eventType].call(validator, this[0], event);
				}
			}
			$(this.currentForm)
				.validateDelegate(":text, [type='password'], [type='file'], select, textarea, " +
					"[type='number'], [type='search'] ,[type='tel'], [type='url'], " +
					"[type='email'], [type='datetime'], [type='date'], [type='month'], " +
					"[type='week'], [type='time'], [type='datetime-local'], " +
					"[type='range'], [type='color'] ",
					"focusin focusout keyup", delegate)
				.validateDelegate("[type='radio'], [type='checkbox'], select, option", "click", delegate);

			if ( this.settings.invalidHandler ) {
				$(this.currentForm).bind("invalid-form.validate", this.settings.invalidHandler);
			}
		},

		// http://docs.jquery.com/Plugins/Validation/Validator/form
		form: function() {
			this.checkForm();
			$.extend(this.submitted, this.errorMap);
			this.invalid = $.extend({}, this.errorMap);
			if ( !this.valid() ) {
				$(this.currentForm).triggerHandler("invalid-form", [this]);
			}
			this.showErrors();
			return this.valid();
		},

		checkForm: function() {
			this.prepareForm();
			for ( var i = 0, elements = (this.currentElements = this.elements()); elements[i]; i++ ) {
				this.check( elements[i] );
			}
			return this.valid();
		},

		// http://docs.jquery.com/Plugins/Validation/Validator/element
		element: function( element ) {
			element = this.validationTargetFor( this.clean( element ) );
			this.lastElement = element;
			this.prepareElement( element );
			this.currentElements = $(element);
			var result = this.check( element ) !== false;
			if ( result ) {
				delete this.invalid[element.name];
			} else {
				this.invalid[element.name] = true;
			}
			if ( !this.numberOfInvalids() ) {
				// Hide error containers on last error
				this.toHide = this.toHide.add( this.containers );
			}
			this.showErrors();
			return result;
		},

		// http://docs.jquery.com/Plugins/Validation/Validator/showErrors
		showErrors: function( errors ) {
			if ( errors ) {
				// add items to error list and map
				$.extend( this.errorMap, errors );
				this.errorList = [];
				for ( var name in errors ) {
					this.errorList.push({
						message: errors[name],
						element: this.findByName(name)[0]
					});
				}
				// remove items from success list
				this.successList = $.grep( this.successList, function( element ) {
					return !(element.name in errors);
				});
			}
			if ( this.settings.showErrors ) {
				this.settings.showErrors.call( this, this.errorMap, this.errorList );
			} else {
				this.defaultShowErrors();
			}
		},

		// http://docs.jquery.com/Plugins/Validation/Validator/resetForm
		resetForm: function() {
			if ( $.fn.resetForm ) {
				$(this.currentForm).resetForm();
			}
			this.submitted = {};
			this.lastElement = null;
			this.prepareForm();
			this.hideErrors();
			this.elements().removeClass( this.settings.errorClass ).removeData( "previousValue" );
		},

		numberOfInvalids: function() {
			return this.objectLength(this.invalid);
		},

		objectLength: function( obj ) {
			var count = 0;
			for ( var i in obj ) {
				count++;
			}
			return count;
		},

		hideErrors: function() {
			this.addWrapper( this.toHide ).hide();
		},

		valid: function() {
			return this.size() === 0;
		},

		size: function() {
			return this.errorList.length;
		},

		focusInvalid: function() {
			if ( this.settings.focusInvalid ) {
				try {
					$(this.findLastActive() || this.errorList.length && this.errorList[0].element || [])
					.filter(":visible")
					.focus()
					// manually trigger focusin event; without it, focusin handler isn't called, findLastActive won't have anything to find
					.trigger("focusin");
				} catch(e) {
					// ignore IE throwing errors when focusing hidden elements
				}
			}
		},

		findLastActive: function() {
			var lastActive = this.lastActive;
			return lastActive && $.grep(this.errorList, function( n ) {
				return n.element.name === lastActive.name;
			}).length === 1 && lastActive;
		},

		elements: function() {
			var validator = this,
				rulesCache = {};

			// select all valid inputs inside the form (no submit or reset buttons)
			return $(this.currentForm)
			.find("input, select, textarea")
			.not(":submit, :reset, :image, [disabled]")
			.not( this.settings.ignore )
			.filter(function() {
				if ( !this.name && validator.settings.debug && window.console ) {
					console.error( "%o has no name assigned", this);
				}

				// select only the first element for each name, and only those with rules specified
				if ( this.name in rulesCache || !validator.objectLength($(this).rules()) ) {
					return false;
				}

				rulesCache[this.name] = true;
				return true;
			});
		},

		clean: function( selector ) {
			return $(selector)[0];
		},

		errors: function() {
			var errorClass = this.settings.errorClass.replace(" ", ".");
			return $(this.settings.errorElement + "." + errorClass, this.errorContext);
		},

		reset: function() {
			this.successList = [];
			this.errorList = [];
			this.errorMap = {};
			this.toShow = $([]);
			this.toHide = $([]);
			this.currentElements = $([]);
		},

		prepareForm: function() {
			this.reset();
			this.toHide = this.errors().add( this.containers );
		},

		prepareElement: function( element ) {
			this.reset();
			this.toHide = this.errorsFor(element);
		},

		elementValue: function( element ) {
			var type = $(element).attr("type"),
				val = $(element).val();

			if ( type === "radio" || type === "checkbox" ) {
				return $("input[name='" + $(element).attr("name") + "']:checked").val();
			}

			if ( typeof val === "string" ) {
				return val.replace(/\r/g, "");
			}
			return val;
		},

		check: function( element ) {
			element = this.validationTargetFor( this.clean( element ) );

			var rules = $(element).rules();
			var dependencyMismatch = false;
			var val = this.elementValue(element);
			var result;

			for (var method in rules ) {
				var rule = { method: method, parameters: rules[method] };
				try {

					result = $.validator.methods[method].call( this, val, element, rule.parameters );

					// if a method indicates that the field is optional and therefore valid,
					// don't mark it as valid when there are no other rules
					if ( result === "dependency-mismatch" ) {
						dependencyMismatch = true;
						continue;
					}
					dependencyMismatch = false;

					if ( result === "pending" ) {
						this.toHide = this.toHide.not( this.errorsFor(element) );
						return;
					}

					if ( !result ) {
						this.formatAndAdd( element, rule );
						return false;
					}
				} catch(e) {
					if ( this.settings.debug && window.console ) {
						console.log( "Exception occurred when checking element " + element.id + ", check the '" + rule.method + "' method.", e );
					}
					throw e;
				}
			}
			if ( dependencyMismatch ) {
				return;
			}
			if ( this.objectLength(rules) ) {
				this.successList.push(element);
			}
			return true;
		},

		// return the custom message for the given element and validation method
		// specified in the element's HTML5 data attribute
		customDataMessage: function( element, method ) {
			return $(element).data("msg-" + method.toLowerCase()) || (element.attributes && $(element).attr("data-msg-" + method.toLowerCase()));
		},

		// return the custom message for the given element name and validation method
		customMessage: function( name, method ) {
			var m = this.settings.messages[name];
			return m && (m.constructor === String ? m : m[method]);
		},

		// return the first defined argument, allowing empty strings
		findDefined: function() {
			for(var i = 0; i < arguments.length; i++) {
				if ( arguments[i] !== undefined ) {
					return arguments[i];
				}
			}
			return undefined;
		},

		defaultMessage: function( element, method ) {
			return this.findDefined(
				this.customMessage( element.name, method ),
				this.customDataMessage( element, method ),
				// title is never undefined, so handle empty string as undefined
				!this.settings.ignoreTitle && element.title || undefined,
				$.validator.messages[method],
				"<strong>Warning: No message defined for " + element.name + "</strong>"
			);
		},

		formatAndAdd: function( element, rule ) {
			var message = this.defaultMessage( element, rule.method ),
				theregex = /\$?\{(\d+)\}/g;
			if ( typeof message === "function" ) {
				message = message.call(this, rule.parameters, element);
			} else if (theregex.test(message)) {
				message = $.validator.format(message.replace(theregex, "{$1}"), rule.parameters);
			}
			this.errorList.push({
				message: message,
				element: element
			});

			this.errorMap[element.name] = message;
			this.submitted[element.name] = message;
		},

		addWrapper: function( toToggle ) {
			if ( this.settings.wrapper ) {
				toToggle = toToggle.add( toToggle.parent( this.settings.wrapper ) );
			}
			return toToggle;
		},

		defaultShowErrors: function() {
			var i, elements;
			for ( i = 0; this.errorList[i]; i++ ) {
				var error = this.errorList[i];
				if ( this.settings.highlight ) {
					this.settings.highlight.call( this, error.element, this.settings.errorClass, this.settings.validClass );
				}
				this.showLabel( error.element, error.message );
			}
			if ( this.errorList.length ) {
				this.toShow = this.toShow.add( this.containers );
			}
			if ( this.settings.success ) {
				for ( i = 0; this.successList[i]; i++ ) {
					this.showLabel( this.successList[i] );
				}
			}
			if ( this.settings.unhighlight ) {
				for ( i = 0, elements = this.validElements(); elements[i]; i++ ) {
					this.settings.unhighlight.call( this, elements[i], this.settings.errorClass, this.settings.validClass );
				}
			}
			this.toHide = this.toHide.not( this.toShow );
			this.hideErrors();
			this.addWrapper( this.toShow ).show();
		},

		validElements: function() {
			return this.currentElements.not(this.invalidElements());
		},

		invalidElements: function() {
			return $(this.errorList).map(function() {
				return this.element;
			});
		},

		showLabel: function( element, message ) {
			var label = this.errorsFor( element );
			if ( label.length ) {
				// refresh error/success class
				label.removeClass( this.settings.validClass ).addClass( this.settings.errorClass );
				// replace message on existing label
				label.html(message);
			} else {
				// create label
				label = $("<" + this.settings.errorElement + ">")
					.attr("for", this.idOrName(element))
					.addClass(this.settings.errorClass)
					.html(message || "");
				if ( this.settings.wrapper ) {
					// make sure the element is visible, even in IE
					// actually showing the wrapped element is handled elsewhere
					label = label.hide().show().wrap("<" + this.settings.wrapper + "/>").parent();
				}
				if ( !this.labelContainer.append(label).length ) {
					if ( this.settings.errorPlacement ) {
						this.settings.errorPlacement(label, $(element) );
					} else {
						label.insertAfter(element);
					}
				}
			}
			if ( !message && this.settings.success ) {
				label.text("");
				if ( typeof this.settings.success === "string" ) {
					label.addClass( this.settings.success );
				} else {
					this.settings.success( label, element );
				}
			}
			this.toShow = this.toShow.add(label);
		},

		errorsFor: function( element ) {
			var name = this.idOrName(element);
			return this.errors().filter(function() {
				return $(this).attr("for") === name;
			});
		},

		idOrName: function( element ) {
			return this.groups[element.name] || (this.checkable(element) ? element.name : element.id || element.name);
		},

		validationTargetFor: function( element ) {
			// if radio/checkbox, validate first element in group instead
			if ( this.checkable(element) ) {
				element = this.findByName( element.name ).not(this.settings.ignore)[0];
			}
			return element;
		},

		checkable: function( element ) {
			return (/radio|checkbox/i).test(element.type);
		},

		findByName: function( name ) {
			return $(this.currentForm).find("[name='" + name + "']");
		},

		getLength: function( value, element ) {
			switch( element.nodeName.toLowerCase() ) {
			case "select":
				return $("option:selected", element).length;
			case "input":
				if ( this.checkable( element) ) {
					return this.findByName(element.name).filter(":checked").length;
				}
			}
			return value.length;
		},

		depend: function( param, element ) {
			return this.dependTypes[typeof param] ? this.dependTypes[typeof param](param, element) : true;
		},

		dependTypes: {
			"boolean": function( param, element ) {
				return param;
			},
			"string": function( param, element ) {
				return !!$(param, element.form).length;
			},
			"function": function( param, element ) {
				return param(element);
			}
		},

		optional: function( element ) {
			var val = this.elementValue(element);
			return !$.validator.methods.required.call(this, val, element) && "dependency-mismatch";
		},

		startRequest: function( element ) {
			if ( !this.pending[element.name] ) {
				this.pendingRequest++;
				this.pending[element.name] = true;
			}
		},

		stopRequest: function( element, valid ) {
			this.pendingRequest--;
			// sometimes synchronization fails, make sure pendingRequest is never < 0
			if ( this.pendingRequest < 0 ) {
				this.pendingRequest = 0;
			}
			delete this.pending[element.name];
			if ( valid && this.pendingRequest === 0 && this.formSubmitted && this.form() ) {
				$(this.currentForm).submit();
				this.formSubmitted = false;
			} else if (!valid && this.pendingRequest === 0 && this.formSubmitted) {
				$(this.currentForm).triggerHandler("invalid-form", [this]);
				this.formSubmitted = false;
			}
		},

		previousValue: function( element ) {
			return $.data(element, "previousValue") || $.data(element, "previousValue", {
				old: null,
				valid: true,
				message: this.defaultMessage( element, "remote" )
			});
		}

	},

	classRuleSettings: {
		required: {required: true},
		email: {email: true},
		url: {url: true},
		date: {date: true},
		dateISO: {dateISO: true},
		number: {number: true},
		digits: {digits: true},
		creditcard: {creditcard: true}
	},

	addClassRules: function( className, rules ) {
		if ( className.constructor === String ) {
			this.classRuleSettings[className] = rules;
		} else {
			$.extend(this.classRuleSettings, className);
		}
	},

	classRules: function( element ) {
		var rules = {};
		var classes = $(element).attr("class");
		if ( classes ) {
			$.each(classes.split(" "), function() {
				if ( this in $.validator.classRuleSettings ) {
					$.extend(rules, $.validator.classRuleSettings[this]);
				}
			});
		}
		return rules;
	},

	attributeRules: function( element ) {
		var rules = {};
		var $element = $(element);
		var type = $element[0].getAttribute("type");

		for (var method in $.validator.methods) {
			var value;

			// support for <input required> in both html5 and older browsers
			if ( method === "required" ) {
				value = $element.get(0).getAttribute(method);
				// Some browsers return an empty string for the required attribute
				// and non-HTML5 browsers might have required="" markup
				if ( value === "" ) {
					value = true;
				}
				// force non-HTML5 browsers to return bool
				value = !!value;
			} else {
				value = $element.attr(method);
			}

			// convert the value to a number for number inputs, and for text for backwards compability
			// allows type="date" and others to be compared as strings
			if ( /min|max/.test( method ) && ( type === null || /number|range|text/.test( type ) ) ) {
				value = Number(value);
			}

			if ( value ) {
				rules[method] = value;
			} else if ( type === method && type !== 'range' ) {
				// exception: the jquery validate 'range' method
				// does not test for the html5 'range' type
				rules[method] = true;
			}
		}

		// maxlength may be returned as -1, 2147483647 (IE) and 524288 (safari) for text inputs
		if ( rules.maxlength && /-1|2147483647|524288/.test(rules.maxlength) ) {
			delete rules.maxlength;
		}

		return rules;
	},

	dataRules: function( element ) {
		var method, value,
			rules = {}, $element = $(element);
		for (method in $.validator.methods) {
			value = $element.data("rule-" + method.toLowerCase());
			if ( value !== undefined ) {
				rules[method] = value;
			}
		}
		return rules;
	},

	staticRules: function( element ) {
		var rules = {};
		var validator = $.data(element.form, "validator");
		if ( validator.settings.rules ) {
			rules = $.validator.normalizeRule(validator.settings.rules[element.name]) || {};
		}
		return rules;
	},

	normalizeRules: function( rules, element ) {
		// handle dependency check
		$.each(rules, function( prop, val ) {
			// ignore rule when param is explicitly false, eg. required:false
			if ( val === false ) {
				delete rules[prop];
				return;
			}
			if ( val.param || val.depends ) {
				var keepRule = true;
				switch (typeof val.depends) {
				case "string":
					keepRule = !!$(val.depends, element.form).length;
					break;
				case "function":
					keepRule = val.depends.call(element, element);
					break;
				}
				if ( keepRule ) {
					rules[prop] = val.param !== undefined ? val.param : true;
				} else {
					delete rules[prop];
				}
			}
		});

		// evaluate parameters
		$.each(rules, function( rule, parameter ) {
			rules[rule] = $.isFunction(parameter) ? parameter(element) : parameter;
		});

		// clean number parameters
		$.each(['minlength', 'maxlength'], function() {
			if ( rules[this] ) {
				rules[this] = Number(rules[this]);
			}
		});
		$.each(['rangelength', 'range'], function() {
			var parts;
			if ( rules[this] ) {
				if ( $.isArray(rules[this]) ) {
					rules[this] = [Number(rules[this][0]), Number(rules[this][1])];
				} else if ( typeof rules[this] === "string" ) {
					parts = rules[this].split(/[\s,]+/);
					rules[this] = [Number(parts[0]), Number(parts[1])];
				}
			}
		});

		if ( $.validator.autoCreateRanges ) {
			// auto-create ranges
			if ( rules.min && rules.max ) {
				rules.range = [rules.min, rules.max];
				delete rules.min;
				delete rules.max;
			}
			if ( rules.minlength && rules.maxlength ) {
				rules.rangelength = [rules.minlength, rules.maxlength];
				delete rules.minlength;
				delete rules.maxlength;
			}
		}

		return rules;
	},

	// Converts a simple string to a {string: true} rule, e.g., "required" to {required:true}
	normalizeRule: function( data ) {
		if ( typeof data === "string" ) {
			var transformed = {};
			$.each(data.split(/\s/), function() {
				transformed[this] = true;
			});
			data = transformed;
		}
		return data;
	},

	// http://docs.jquery.com/Plugins/Validation/Validator/addMethod
	addMethod: function( name, method, message ) {
		$.validator.methods[name] = method;
		$.validator.messages[name] = message !== undefined ? message : $.validator.messages[name];
		if ( method.length < 3 ) {
			$.validator.addClassRules(name, $.validator.normalizeRule(name));
		}
	},

	methods: {

		// http://docs.jquery.com/Plugins/Validation/Methods/required
		required: function( value, element, param ) {
			// check if dependency is met
			if ( !this.depend(param, element) ) {
				return "dependency-mismatch";
			}
			if ( element.nodeName.toLowerCase() === "select" ) {
				// could be an array for select-multiple or a string, both are fine this way
				var val = $(element).val();
				return val && val.length > 0;
			}
			if ( this.checkable(element) ) {
				return this.getLength(value, element) > 0;
			}
			return $.trim(value).length > 0;
		},

		// http://docs.jquery.com/Plugins/Validation/Methods/email
		email: function( value, element ) {
			// contributed by Scott Gonzalez: http://projects.scottsplayground.com/email_address_validation/
			return this.optional(element) || /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i.test(value);
		},

		// http://docs.jquery.com/Plugins/Validation/Methods/url
		url: function( value, element ) {
			// contributed by Scott Gonzalez: http://projects.scottsplayground.com/iri/
			return this.optional(element) || /^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value);
		},

		// http://docs.jquery.com/Plugins/Validation/Methods/date
		date: function( value, element ) {
			return this.optional(element) || !/Invalid|NaN/.test(new Date(value).toString());
		},

		// http://docs.jquery.com/Plugins/Validation/Methods/dateISO
		dateISO: function( value, element ) {
			return this.optional(element) || /^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/.test(value);
		},

		// http://docs.jquery.com/Plugins/Validation/Methods/number
		number: function( value, element ) {
			return this.optional(element) || /^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(value);
		},

		// http://docs.jquery.com/Plugins/Validation/Methods/digits
		digits: function( value, element ) {
			return this.optional(element) || /^\d+$/.test(value);
		},

		// http://docs.jquery.com/Plugins/Validation/Methods/creditcard
		// based on http://en.wikipedia.org/wiki/Luhn
		creditcard: function( value, element ) {
			if ( this.optional(element) ) {
				return "dependency-mismatch";
			}
			// accept only spaces, digits and dashes
			if ( /[^0-9 \-]+/.test(value) ) {
				return false;
			}
			var nCheck = 0,
				nDigit = 0,
				bEven = false;

			value = value.replace(/\D/g, "");

			for (var n = value.length - 1; n >= 0; n--) {
				var cDigit = value.charAt(n);
				nDigit = parseInt(cDigit, 10);
				if ( bEven ) {
					if ( (nDigit *= 2) > 9 ) {
						nDigit -= 9;
					}
				}
				nCheck += nDigit;
				bEven = !bEven;
			}

			return (nCheck % 10) === 0;
		},

		// http://docs.jquery.com/Plugins/Validation/Methods/minlength
		minlength: function( value, element, param ) {
			var length = $.isArray( value ) ? value.length : this.getLength($.trim(value), element);
			return this.optional(element) || length >= param;
		},

		// http://docs.jquery.com/Plugins/Validation/Methods/maxlength
		maxlength: function( value, element, param ) {
			var length = $.isArray( value ) ? value.length : this.getLength($.trim(value), element);
			return this.optional(element) || length <= param;
		},

		// http://docs.jquery.com/Plugins/Validation/Methods/rangelength
		rangelength: function( value, element, param ) {
			var length = $.isArray( value ) ? value.length : this.getLength($.trim(value), element);
			return this.optional(element) || ( length >= param[0] && length <= param[1] );
		},

		// http://docs.jquery.com/Plugins/Validation/Methods/min
		min: function( value, element, param ) {
			return this.optional(element) || value >= param;
		},

		// http://docs.jquery.com/Plugins/Validation/Methods/max
		max: function( value, element, param ) {
			return this.optional(element) || value <= param;
		},

		// http://docs.jquery.com/Plugins/Validation/Methods/range
		range: function( value, element, param ) {
			return this.optional(element) || ( value >= param[0] && value <= param[1] );
		},

		// http://docs.jquery.com/Plugins/Validation/Methods/equalTo
		equalTo: function( value, element, param ) {
			// bind to the blur event of the target in order to revalidate whenever the target field is updated
			// TODO find a way to bind the event just once, avoiding the unbind-rebind overhead
			var target = $(param);
			if ( this.settings.onfocusout ) {
				target.unbind(".validate-equalTo").bind("blur.validate-equalTo", function() {
					$(element).valid();
				});
			}
			return value === target.val();
		},

		// http://docs.jquery.com/Plugins/Validation/Methods/remote
		remote: function( value, element, param ) {
			if ( this.optional(element) ) {
				return "dependency-mismatch";
			}

			var previous = this.previousValue(element);
			if (!this.settings.messages[element.name] ) {
				this.settings.messages[element.name] = {};
			}
			previous.originalMessage = this.settings.messages[element.name].remote;
			this.settings.messages[element.name].remote = previous.message;

			param = typeof param === "string" && {url:param} || param;

			if ( previous.old === value ) {
				return previous.valid;
			}

			previous.old = value;
			var validator = this;
			this.startRequest(element);
			var data = {};
			data[element.name] = value;
			$.ajax($.extend(true, {
				url: param,
				mode: "abort",
				port: "validate" + element.name,
				dataType: "json",
				data: data,
				success: function( response ) {
					validator.settings.messages[element.name].remote = previous.originalMessage;
					var valid = response === true || response === "true";
					if ( valid ) {
						var submitted = validator.formSubmitted;
						validator.prepareElement(element);
						validator.formSubmitted = submitted;
						validator.successList.push(element);
						delete validator.invalid[element.name];
						validator.showErrors();
					} else {
						var errors = {};
						var message = response || validator.defaultMessage( element, "remote" );
						errors[element.name] = previous.message = $.isFunction(message) ? message(value) : message;
						validator.invalid[element.name] = true;
						validator.showErrors(errors);
					}
					previous.valid = valid;
					validator.stopRequest(element, valid);
				}
			}, param));
			return "pending";
		}

	}

});

// deprecated, use $.validator.format instead
$.format = $.validator.format;

}(jQuery));

// ajax mode: abort
// usage: $.ajax({ mode: "abort"[, port: "uniqueport"]});
// if mode:"abort" is used, the previous request on that port (port can be undefined) is aborted via XMLHttpRequest.abort()
(function($) {
	var pendingRequests = {};
	// Use a prefilter if available (1.5+)
	if ( $.ajaxPrefilter ) {
		$.ajaxPrefilter(function( settings, _, xhr ) {
			var port = settings.port;
			if ( settings.mode === "abort" ) {
				if ( pendingRequests[port] ) {
					pendingRequests[port].abort();
				}
				pendingRequests[port] = xhr;
			}
		});
	} else {
		// Proxy ajax
		var ajax = $.ajax;
		$.ajax = function( settings ) {
			var mode = ( "mode" in settings ? settings : $.ajaxSettings ).mode,
				port = ( "port" in settings ? settings : $.ajaxSettings ).port;
			if ( mode === "abort" ) {
				if ( pendingRequests[port] ) {
					pendingRequests[port].abort();
				}
				pendingRequests[port] = ajax.apply(this, arguments);
				return pendingRequests[port];
			}
			return ajax.apply(this, arguments);
		};
	}
}(jQuery));

// provides delegate(type: String, delegate: Selector, handler: Callback) plugin for easier event delegation
// handler is only called when $(event.target).is(delegate), in the scope of the jquery-object for event.target
(function($) {
	$.extend($.fn, {
		validateDelegate: function( delegate, type, handler ) {
			return this.bind(type, function( event ) {
				var target = $(event.target);
				if ( target.is(delegate) ) {
					return handler.apply(target, arguments);
				}
			});
		}
	});
}(jQuery));
;
/* NUGET: BEGIN LICENSE TEXT
*
* Microsoft grants you the right to use these script files for the sole
* purpose of either: (i) interacting through your browser with the Microsoft
* website or online service, subject to the applicable licensing or use
* terms; or (ii) using the files as included with a Microsoft product subject
* to that product's license terms. Microsoft reserves all other rights to the
* files not expressly granted by Microsoft, whether by implication, estoppel
* or otherwise. Insofar as a script file is dual licensed under GPL,
* Microsoft neither took the code under GPL nor distributes it thereunder but
* under the terms set out in this paragraph. All notices and licenses
* below are for informational purposes only.
*
* NUGET: END LICENSE TEXT */
/*!
** Unobtrusive validation support library for jQuery and jQuery Validate
** Copyright (C) Microsoft Corporation. All rights reserved.
*/
/*jslint white: true, browser: true, onevar: true, undef: true, nomen: true, eqeqeq: true, plusplus: true, bitwise: true, regexp: true, newcap: true, immed: true, strict: false */
/*global document: false, jQuery: false */
(function ($) {
var $jQval = $.validator,
adapters,
data_validation = "unobtrusiveValidation";
function setValidationValues(options, ruleName, value) {
options.rules[ruleName] = value;
if (options.message) {
options.messages[ruleName] = options.message;
}
}
function splitAndTrim(value) {
return value.replace(/^\s+|\s+$/g, "").split(/\s*,\s*/g);
}
function escapeAttributeValue(value) {
// As mentioned on http://api.jquery.com/category/selectors/
return value.replace(/([!"#$%&'()*+,./:;<=>?@\[\\\]^`{|}~])/g, "\\$1");
}
function getModelPrefix(fieldName) {
return fieldName.substr(0, fieldName.lastIndexOf(".") + 1);
}
function appendModelPrefix(value, prefix) {
if (value.indexOf("*.") === 0) {
value = value.replace("*.", prefix);
}
return value;
}
function onError(error, inputElement) {  // 'this' is the form element
var container = $(this).find("[data-valmsg-for='" + escapeAttributeValue(inputElement[0].name) + "']"),
replaceAttrValue = container.attr("data-valmsg-replace"),
replace = replaceAttrValue ? $.parseJSON(replaceAttrValue) !== false : null;
container.removeClass("field-validation-valid").addClass("field-validation-error");
error.data("unobtrusiveContainer", container);
if (replace) {
container.empty();
error.removeClass("input-validation-error").appendTo(container);
}
else {
error.hide();
}
}
function onErrors(event, validator) {  // 'this' is the form element
var container = $(this).find("[data-valmsg-summary=true]"),
list = container.find("ul");
if (list && list.length && validator.errorList.length) {
list.empty();
container.addClass("validation-summary-errors").removeClass("validation-summary-valid");
$.each(validator.errorList, function () {
$("<li />").html(this.message).appendTo(list);
});
}
}
function onSuccess(error) {  // 'this' is the form element
var container = error.data("unobtrusiveContainer"),
replaceAttrValue = container.attr("data-valmsg-replace"),
replace = replaceAttrValue ? $.parseJSON(replaceAttrValue) : null;
if (container) {
container.addClass("field-validation-valid").removeClass("field-validation-error");
error.removeData("unobtrusiveContainer");
if (replace) {
container.empty();
}
}
}
function onReset(event) {  // 'this' is the form element
var $form = $(this);
$form.data("validator").resetForm();
$form.find(".validation-summary-errors")
.addClass("validation-summary-valid")
.removeClass("validation-summary-errors");
$form.find(".field-validation-error")
.addClass("field-validation-valid")
.removeClass("field-validation-error")
.removeData("unobtrusiveContainer")
.find(">*")  // If we were using valmsg-replace, get the underlying error
.removeData("unobtrusiveContainer");
}
function validationInfo(form) {
var $form = $(form),
result = $form.data(data_validation),
onResetProxy = $.proxy(onReset, form);
if (!result) {
result = {
options: {  // options structure passed to jQuery Validate's validate() method
errorClass: "input-validation-error",
errorElement: "span",
errorPlacement: $.proxy(onError, form),
invalidHandler: $.proxy(onErrors, form),
messages: {},
rules: {},
success: $.proxy(onSuccess, form)
},
attachValidation: function () {
$form
.unbind("reset." + data_validation, onResetProxy)
.bind("reset." + data_validation, onResetProxy)
.validate(this.options);
},
validate: function () {  // a validation function that is called by unobtrusive Ajax
$form.validate();
return $form.valid();
}
};
$form.data(data_validation, result);
}
return result;
}
$jQval.unobtrusive = {
adapters: [],
parseElement: function (element, skipAttach) {
/// <summary>
/// Parses a single HTML element for unobtrusive validation attributes.
/// </summary>
/// <param name="element" domElement="true">The HTML element to be parsed.</param>
/// <param name="skipAttach" type="Boolean">[Optional] true to skip attaching the
/// validation to the form. If parsing just this single element, you should specify true.
/// If parsing several elements, you should specify false, and manually attach the validation
/// to the form when you are finished. The default is false.</param>
var $element = $(element),
form = $element.parents("form")[0],
valInfo, rules, messages;
if (!form) {  // Cannot do client-side validation without a form
return;
}
valInfo = validationInfo(form);
valInfo.options.rules[element.name] = rules = {};
valInfo.options.messages[element.name] = messages = {};
$.each(this.adapters, function () {
var prefix = "data-val-" + this.name,
message = $element.attr(prefix),
paramValues = {};
if (message !== undefined) {  // Compare against undefined, because an empty message is legal (and falsy)
prefix += "-";
$.each(this.params, function () {
paramValues[this] = $element.attr(prefix + this);
});
this.adapt({
element: element,
form: form,
message: message,
params: paramValues,
rules: rules,
messages: messages
});
}
});
$.extend(rules, { "__dummy__": true });
if (!skipAttach) {
valInfo.attachValidation();
}
},
parse: function (selector) {
/// <summary>
/// Parses all the HTML elements in the specified selector. It looks for input elements decorated
/// with the [data-val=true] attribute value and enables validation according to the data-val-*
/// attribute values.
/// </summary>
/// <param name="selector" type="String">Any valid jQuery selector.</param>
var $forms = $(selector)
.parents("form")
.andSelf()
.add($(selector).find("form"))
.filter("form");
// :input is a psuedoselector provided by jQuery which selects input and input-like elements
// combining :input with other selectors significantly decreases performance.
$(selector).find(":input").filter("[data-val=true]").each(function () {
$jQval.unobtrusive.parseElement(this, true);
});
$forms.each(function () {
var info = validationInfo(this);
if (info) {
info.attachValidation();
}
});
}
};
adapters = $jQval.unobtrusive.adapters;
adapters.add = function (adapterName, params, fn) {
/// <summary>Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation.</summary>
/// <param name="adapterName" type="String">The name of the adapter to be added. This matches the name used
/// in the data-val-nnnn HTML attribute (where nnnn is the adapter name).</param>
/// <param name="params" type="Array" optional="true">[Optional] An array of parameter names (strings) that will
/// be extracted from the data-val-nnnn-mmmm HTML attributes (where nnnn is the adapter name, and
/// mmmm is the parameter name).</param>
/// <param name="fn" type="Function">The function to call, which adapts the values from the HTML
/// attributes into jQuery Validate rules and/or messages.</param>
/// <returns type="jQuery.validator.unobtrusive.adapters" />
if (!fn) {  // Called with no params, just a function
fn = params;
params = [];
}
this.push({ name: adapterName, params: params, adapt: fn });
return this;
};
adapters.addBool = function (adapterName, ruleName) {
/// <summary>Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation, where
/// the jQuery Validate validation rule has no parameter values.</summary>
/// <param name="adapterName" type="String">The name of the adapter to be added. This matches the name used
/// in the data-val-nnnn HTML attribute (where nnnn is the adapter name).</param>
/// <param name="ruleName" type="String" optional="true">[Optional] The name of the jQuery Validate rule. If not provided, the value
/// of adapterName will be used instead.</param>
/// <returns type="jQuery.validator.unobtrusive.adapters" />
return this.add(adapterName, function (options) {
setValidationValues(options, ruleName || adapterName, true);
});
};
adapters.addMinMax = function (adapterName, minRuleName, maxRuleName, minMaxRuleName, minAttribute, maxAttribute) {
/// <summary>Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation, where
/// the jQuery Validate validation has three potential rules (one for min-only, one for max-only, and
/// one for min-and-max). The HTML parameters are expected to be named -min and -max.</summary>
/// <param name="adapterName" type="String">The name of the adapter to be added. This matches the name used
/// in the data-val-nnnn HTML attribute (where nnnn is the adapter name).</param>
/// <param name="minRuleName" type="String">The name of the jQuery Validate rule to be used when you only
/// have a minimum value.</param>
/// <param name="maxRuleName" type="String">The name of the jQuery Validate rule to be used when you only
/// have a maximum value.</param>
/// <param name="minMaxRuleName" type="String">The name of the jQuery Validate rule to be used when you
/// have both a minimum and maximum value.</param>
/// <param name="minAttribute" type="String" optional="true">[Optional] The name of the HTML attribute that
/// contains the minimum value. The default is "min".</param>
/// <param name="maxAttribute" type="String" optional="true">[Optional] The name of the HTML attribute that
/// contains the maximum value. The default is "max".</param>
/// <returns type="jQuery.validator.unobtrusive.adapters" />
return this.add(adapterName, [minAttribute || "min", maxAttribute || "max"], function (options) {
var min = options.params.min,
max = options.params.max;
if (min && max) {
setValidationValues(options, minMaxRuleName, [min, max]);
}
else if (min) {
setValidationValues(options, minRuleName, min);
}
else if (max) {
setValidationValues(options, maxRuleName, max);
}
});
};
adapters.addSingleVal = function (adapterName, attribute, ruleName) {
/// <summary>Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation, where
/// the jQuery Validate validation rule has a single value.</summary>
/// <param name="adapterName" type="String">The name of the adapter to be added. This matches the name used
/// in the data-val-nnnn HTML attribute(where nnnn is the adapter name).</param>
/// <param name="attribute" type="String">[Optional] The name of the HTML attribute that contains the value.
/// The default is "val".</param>
/// <param name="ruleName" type="String" optional="true">[Optional] The name of the jQuery Validate rule. If not provided, the value
/// of adapterName will be used instead.</param>
/// <returns type="jQuery.validator.unobtrusive.adapters" />
return this.add(adapterName, [attribute || "val"], function (options) {
setValidationValues(options, ruleName || adapterName, options.params[attribute]);
});
};
$jQval.addMethod("__dummy__", function (value, element, params) {
return true;
});
$jQval.addMethod("regex", function (value, element, params) {
var match;
if (this.optional(element)) {
return true;
}
match = new RegExp(params).exec(value);
return (match && (match.index === 0) && (match[0].length === value.length));
});
$jQval.addMethod("nonalphamin", function (value, element, nonalphamin) {
var match;
if (nonalphamin) {
match = value.match(/\W/g);
match = match && match.length >= nonalphamin;
}
return match;
});
if ($jQval.methods.extension) {
adapters.addSingleVal("accept", "mimtype");
adapters.addSingleVal("extension", "extension");
} else {
// for backward compatibility, when the 'extension' validation method does not exist, such as with versions
// of JQuery Validation plugin prior to 1.10, we should use the 'accept' method for
// validating the extension, and ignore mime-type validations as they are not supported.
adapters.addSingleVal("extension", "extension", "accept");
}
adapters.addSingleVal("regex", "pattern");
adapters.addBool("creditcard").addBool("date").addBool("digits").addBool("email").addBool("number").addBool("url");
adapters.addMinMax("length", "minlength", "maxlength", "rangelength").addMinMax("range", "min", "max", "range");
adapters.add("equalto", ["other"], function (options) {
var prefix = getModelPrefix(options.element.name),
other = options.params.other,
fullOtherName = appendModelPrefix(other, prefix),
element = $(options.form).find(":input").filter("[name='" + escapeAttributeValue(fullOtherName) + "']")[0];
setValidationValues(options, "equalTo", element);
});
adapters.add("required", function (options) {
// jQuery Validate equates "required" with "mandatory" for checkbox elements
if (options.element.tagName.toUpperCase() !== "INPUT" || options.element.type.toUpperCase() !== "CHECKBOX") {
setValidationValues(options, "required", true);
}
});
adapters.add("remote", ["url", "type", "additionalfields"], function (options) {
var value = {
url: options.params.url,
type: options.params.type || "GET",
data: {}
},
prefix = getModelPrefix(options.element.name);
$.each(splitAndTrim(options.params.additionalfields || options.element.name), function (i, fieldName) {
var paramName = appendModelPrefix(fieldName, prefix);
value.data[paramName] = function () {
return $(options.form).find(":input").filter("[name='" + escapeAttributeValue(paramName) + "']").val();
};
});
setValidationValues(options, "remote", value);
});
adapters.add("password", ["min", "nonalphamin", "regex"], function (options) {
if (options.params.min) {
setValidationValues(options, "minlength", options.params.min);
}
if (options.params.nonalphamin) {
setValidationValues(options, "nonalphamin", options.params.nonalphamin);
}
if (options.params.regex) {
setValidationValues(options, "regex", options.params.regex);
}
});
$(function () {
$jQval.unobtrusive.parse(document);
});
}(jQuery));
;
/* Modernizr 2.8.3 (Custom Build) | MIT & BSD
 * Build: http://modernizr.com/download/#-cssgradients-cssclasses-teststyles-testprop-prefixes
 */
;



window.Modernizr = (function (window, document, undefined) {

    var version = '2.8.3',

    Modernizr = {},

    enableClasses = true,

    docElement = document.documentElement,

    mod = 'modernizr',
    modElem = document.createElement(mod),
    mStyle = modElem.style,

    inputElem,


    toString = {}.toString,

    prefixes = ' -webkit- -moz- -o- -ms- '.split(' '),



    tests = {},
    inputs = {},
    attrs = {},

    classes = [],

    slice = classes.slice,

    featureName,


    injectElementWithStyles = function (rule, callback, nodes, testnames) {

        var style, ret, node, docOverflow,
            div = document.createElement('div'),
                  body = document.body,
                  fakeBody = body || document.createElement('body');

        if (parseInt(nodes, 10)) {
            while (nodes--) {
                node = document.createElement('div');
                node.id = testnames ? testnames[nodes] : mod + (nodes + 1);
                div.appendChild(node);
            }
        }

        style = ['&#173;', '<style id="s', mod, '">', rule, '</style>'].join('');
        div.id = mod;
        (body ? div : fakeBody).innerHTML += style;
        fakeBody.appendChild(div);
        if (!body) {
            fakeBody.style.background = '';
            fakeBody.style.overflow = 'hidden';
            docOverflow = docElement.style.overflow;
            docElement.style.overflow = 'hidden';
            docElement.appendChild(fakeBody);
        }

        ret = callback(div, rule);
        if (!body) {
            fakeBody.parentNode.removeChild(fakeBody);
            docElement.style.overflow = docOverflow;
        } else {
            div.parentNode.removeChild(div);
        }

        return !!ret;

    },
    _hasOwnProperty = ({}).hasOwnProperty, hasOwnProp;

    if (!is(_hasOwnProperty, 'undefined') && !is(_hasOwnProperty.call, 'undefined')) {
        hasOwnProp = function (object, property) {
            return _hasOwnProperty.call(object, property);
        };
    }
    else {
        hasOwnProp = function (object, property) {
            return ((property in object) && is(object.constructor.prototype[property], 'undefined'));
        };
    }


    if (!Function.prototype.bind) {
        Function.prototype.bind = function bind(that) {

            var target = this;

            if (typeof target != "function") {
                throw new TypeError();
            }

            var args = slice.call(arguments, 1),
                bound = function () {

                    if (this instanceof bound) {

                        var F = function () { };
                        F.prototype = target.prototype;
                        var self = new F();

                        var result = target.apply(
                            self,
                            args.concat(slice.call(arguments))
                        );
                        if (Object(result) === result) {
                            return result;
                        }
                        return self;

                    } else {

                        return target.apply(
                            that,
                            args.concat(slice.call(arguments))
                        );

                    }

                };

            return bound;
        };
    }

    function setCss(str) {
        mStyle.cssText = str;
    }

    function setCssAll(str1, str2) {
        return setCss(prefixes.join(str1 + ';') + (str2 || ''));
    }

    function is(obj, type) {
        return typeof obj === type;
    }

    function contains(str, substr) {
        return !!~('' + str).indexOf(substr);
    }

    function testProps(props, prefixed) {
        for (var i in props) {
            var prop = props[i];
            if (!contains(prop, "-") && mStyle[prop] !== undefined) {
                return prefixed == 'pfx' ? prop : true;
            }
        }
        return false;
    }

    function testDOMProps(props, obj, elem) {
        for (var i in props) {
            var item = obj[props[i]];
            if (item !== undefined) {

                if (elem === false) return props[i];

                if (is(item, 'function')) {
                    return item.bind(elem || obj);
                }

                return item;
            }
        }
        return false;
    } tests['cssgradients'] = function () {
        var str1 = 'background-image:',
            str2 = 'gradient(linear,left top,right bottom,from(#9f9),to(white));',
            str3 = 'linear-gradient(left top,#9f9, white);';

        setCss(
                       (str1 + '-webkit- '.split(' ').join(str2 + str1) +
                       prefixes.join(str3 + str1)).slice(0, -str1.length)
        );

        return contains(mStyle.backgroundImage, 'gradient');
    };

    for (var feature in tests) {
        if (hasOwnProp(tests, feature)) {
            featureName = feature.toLowerCase();
            Modernizr[featureName] = tests[feature]();

            classes.push((Modernizr[featureName] ? '' : 'no-') + featureName);
        }
    }



    Modernizr.addTest = function (feature, test) {
        if (typeof feature == 'object') {
            for (var key in feature) {
                if (hasOwnProp(feature, key)) {
                    Modernizr.addTest(key, feature[key]);
                }
            }
        } else {

            feature = feature.toLowerCase();

            if (Modernizr[feature] !== undefined) {
                return Modernizr;
            }

            test = typeof test == 'function' ? test() : test;

            if (typeof enableClasses !== "undefined" && enableClasses) {
                docElement.className += ' ' + (test ? '' : 'no-') + feature;
            }
            Modernizr[feature] = test;

        }

        return Modernizr;
    };


    setCss('');
    modElem = inputElem = null;


    Modernizr._version = version;

    Modernizr._prefixes = prefixes;



    Modernizr.testProp = function (prop) {
        return testProps([prop]);
    };



    Modernizr.testStyles = injectElementWithStyles; docElement.className = docElement.className.replace(/(^|\s)no-js(\s|$)/, '$1$2') +

                                                    (enableClasses ? ' js ' + classes.join(' ') : '');

    return Modernizr;

})(this, this.document);
;;
/*!
 * https://github.com/es-shims/es5-shim
 * @license es5-shim Copyright 2009-2015 by contributors, MIT License
 * see https://github.com/es-shims/es5-shim/blob/master/LICENSE
 */
(function(n,t){"use strict";typeof define=="function"&&define.amd?define(t):typeof exports=="object"?module.exports=t():n.returnExports=t()})(this,function(){var b=Array,n=b.prototype,e=Object,d=e.prototype,vt=Function.prototype,o=String,l=o.prototype,f=Number,yt=f.prototype,v=n.slice,pt=n.splice,s=n.push,wi=n.unshift,wt=n.concat,g=vt.call,w=Math.max,it=Math.min,rt=d.toString,ut=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol",u,bi=Function.prototype.toString,ki=function(n){try{return bi.call(n),!0}catch(t){return!1}},di="[object Function]",gi="[object GeneratorFunction]",ht,ct,dt,gt,ni,ti,ii,ri,oi,lt,ci,li,t,at,vi,yi,pi;u=function(n){if(typeof n!="function")return!1;if(ut)return ki(n);var t=rt.call(n);return t===di||t===gi};var ft,nr=RegExp.prototype.exec,tr=function(n){try{return nr.call(n),!0}catch(t){return!1}},ir="[object RegExp]";ft=function(n){return typeof n!="object"?!1:ut?tr(n):rt.call(n)===ir};var h,rr=String.prototype.valueOf,ur=function(n){try{return rr.call(n),!0}catch(t){return!1}},fr="[object String]";h=function(n){return typeof n=="string"?!0:typeof n!="object"?!1:ut?ur(n):rt.call(n)===fr};var i=function(n){var i=e.defineProperty&&function(){var n,t;try{n={};e.defineProperty(n,"x",{enumerable:!1,value:n});for(t in n)return!1;return n.x===n}catch(i){return!1}}(),t;return t=i?function(n,t,i,r){!r&&t in n||e.defineProperty(n,t,{configurable:!0,enumerable:!1,writable:!0,value:i})}:function(n,t,i,r){!r&&t in n||(n[t]=i)},function(i,r,u){for(var f in r)n.call(r,f)&&t(i,f,r[f],u)}}(d.hasOwnProperty),et=function(n){var t=typeof n;return n===null||t!=="object"&&t!=="function"},r={ToInteger:function(n){var t=+n;return t!==t?t=0:t!==0&&t!==1/0&&t!==-(1/0)&&(t=(t>0||-1)*Math.floor(Math.abs(t))),t},ToPrimitive:function(n){var t,i,r;if(et(n))return n;if((i=n.valueOf,u(i)&&(t=i.call(n),et(t)))||(r=n.toString,u(r)&&(t=r.call(n),et(t))))return t;throw new TypeError;},ToObject:function(n){if(n==null)throw new TypeError("can't convert "+n+" to object");return e(n)},ToUint32:function(n){return n>>>0}},ot=function(){};i(vt,{bind:function(n){var t=this,r;if(!u(t))throw new TypeError("Function.prototype.bind called on incompatible "+t);var f=v.call(arguments,1),i,h=function(){if(this instanceof i){var r=t.apply(this,wt.call(f,v.call(arguments)));return e(r)===r?r:this}return t.apply(n,wt.call(f,v.call(arguments)))},c=w(0,t.length-f.length),o=[];for(r=0;r<c;r++)s.call(o,"$"+r);return i=Function("binder","return function ("+o.join(",")+"){ return binder.apply(this, arguments); }")(h),t.prototype&&(ot.prototype=t.prototype,i.prototype=new ot,ot.prototype=null),i}});var p=g.bind(d.hasOwnProperty),bt=g.bind(d.toString),a=g.bind(l.slice),c=g.bind(l.split),st=b.isArray||function(n){return bt(n)==="[object Array]"},er=[].unshift(0)!==1;i(n,{unshift:function(){return wi.apply(this,arguments),this.length}},er);i(b,{isArray:st});var kt=e("a"),y=kt[0]!=="a"||!(0 in kt),k=function(n){var t=!0,i=!0;return n&&(n.call("foo",function(n,i,r){typeof r!="object"&&(t=!1)}),n.call([1],function(){"use strict";i=typeof this=="string"},"x")),!!n&&t&&i};i(n,{forEach:function(n){var f=r.ToObject(this),i=y&&h(this)?c(this,""):f,t=-1,o=i.length>>>0,e;if(arguments.length>1&&(e=arguments[1]),!u(n))throw new TypeError("Array.prototype.forEach callback must be a function");while(++t<o)t in i&&(typeof e!="undefined"?n.call(e,i[t],t,f):n(i[t],t,f))}},!k(n.forEach));i(n,{map:function(n){var f=r.ToObject(this),i=y&&h(this)?c(this,""):f,o=i.length>>>0,s=b(o),e,t;if(arguments.length>1&&(e=arguments[1]),!u(n))throw new TypeError("Array.prototype.map callback must be a function");for(t=0;t<o;t++)t in i&&(s[t]=typeof e!="undefined"?n.call(e,i[t],t,f):n(i[t],t,f));return s}},!k(n.map));i(n,{filter:function(n){var f=r.ToObject(this),e=y&&h(this)?c(this,""):f,a=e.length>>>0,l=[],i,o,t;if(arguments.length>1&&(o=arguments[1]),!u(n))throw new TypeError("Array.prototype.filter callback must be a function");for(t=0;t<a;t++)t in e&&(i=e[t],(typeof o=="undefined"?n(i,t,f):n.call(o,i,t,f))&&s.call(l,i));return l}},!k(n.filter));i(n,{every:function(n){var f=r.ToObject(this),i=y&&h(this)?c(this,""):f,o=i.length>>>0,e,t;if(arguments.length>1&&(e=arguments[1]),!u(n))throw new TypeError("Array.prototype.every callback must be a function");for(t=0;t<o;t++)if(t in i&&!(typeof e=="undefined"?n(i[t],t,f):n.call(e,i[t],t,f)))return!1;return!0}},!k(n.every));i(n,{some:function(n){var f=r.ToObject(this),i=y&&h(this)?c(this,""):f,o=i.length>>>0,e,t;if(arguments.length>1&&(e=arguments[1]),!u(n))throw new TypeError("Array.prototype.some callback must be a function");for(t=0;t<o;t++)if(t in i&&(typeof e=="undefined"?n(i[t],t,f):n.call(e,i[t],t,f)))return!0;return!1}},!k(n.some));ht=!1;n.reduce&&(ht=typeof n.reduce.call("es5",function(n,t,i,r){return r})=="object");i(n,{reduce:function(n){var o=r.ToObject(this),i=y&&h(this)?c(this,""):o,e=i.length>>>0,t,f;if(!u(n))throw new TypeError("Array.prototype.reduce callback must be a function");if(e===0&&arguments.length===1)throw new TypeError("reduce of empty array with no initial value");if(t=0,arguments.length>=2)f=arguments[1];else do{if(t in i){f=i[t++];break}if(++t>=e)throw new TypeError("reduce of empty array with no initial value");}while(1);for(;t<e;t++)t in i&&(f=n(f,i[t],t,o));return f}},!ht);ct=!1;n.reduceRight&&(ct=typeof n.reduceRight.call("es5",function(n,t,i,r){return r})=="object");i(n,{reduceRight:function(n){var e=r.ToObject(this),f=y&&h(this)?c(this,""):e,o=f.length>>>0,i,t;if(!u(n))throw new TypeError("Array.prototype.reduceRight callback must be a function");if(o===0&&arguments.length===1)throw new TypeError("reduceRight of empty array with no initial value");if(t=o-1,arguments.length>=2)i=arguments[1];else do{if(t in f){i=f[t--];break}if(--t<0)throw new TypeError("reduceRight of empty array with no initial value");}while(1);if(t<0)return i;do t in f&&(i=n(i,f[t],t,e));while(t--);return i}},!ct);dt=n.indexOf&&[0,1].indexOf(1,2)!==-1;i(n,{indexOf:function(n){var i=y&&h(this)?c(this,""):r.ToObject(this),u=i.length>>>0,t;if(u===0)return-1;for(t=0,arguments.length>1&&(t=r.ToInteger(arguments[1])),t=t>=0?t:w(0,u+t);t<u;t++)if(t in i&&i[t]===n)return t;return-1}},dt);gt=n.lastIndexOf&&[0,1].lastIndexOf(0,-3)!==-1;i(n,{lastIndexOf:function(n){var i=y&&h(this)?c(this,""):r.ToObject(this),u=i.length>>>0,t;if(u===0)return-1;for(t=u-1,arguments.length>1&&(t=it(t,r.ToInteger(arguments[1]))),t=t>=0?t:u-Math.abs(t);t>=0;t--)if(t in i&&n===i[t])return t;return-1}},gt);ni=function(){var n=[1,2],t=n.splice();return n.length===2&&st(t)&&t.length===0}();i(n,{splice:function(){return arguments.length===0?[]:pt.apply(this,arguments)}},!ni);ti=function(){var t={};return n.splice.call(t,0,0,1),t.length===1}();i(n,{splice:function(n,t){if(arguments.length===0)return[];var i=arguments;return this.length=w(r.ToInteger(this.length),0),arguments.length>0&&typeof t!="number"&&(i=v.call(arguments),i.length<2?s.call(i,this.length-n):i[1]=r.ToInteger(t)),pt.apply(this,i)}},!ti);ii=function(){var n=new b(1e5);return n[8]="x",n.splice(1,1),n.indexOf("x")===7}();ri=function(){var n=256,t=[];return t[n]="a",t.splice(n+1,0,"b"),t[n]==="a"}();i(n,{splice:function(n,t){for(var u=r.ToObject(this),k=[],s=r.ToUint32(u.length),b=r.ToInteger(n),l=b<0?w(s+b,0):it(b,s),f=it(w(r.ToInteger(t),0),s-l),i=0,e,a,h,c,y;i<f;)e=o(l+i),p(u,e)&&(k[i]=u[e]),i+=1;if(a=v.call(arguments,2),h=a.length,h<f){for(i=l;i<s-f;)e=o(i+f),c=o(i+h),p(u,e)?u[c]=u[e]:delete u[c],i+=1;for(i=s;i>s-f+h;)delete u[i-1],i-=1}else if(h>f)for(i=s-f;i>l;)e=o(i+f-1),c=o(i+h-1),p(u,e)?u[c]=u[e]:delete u[c],i-=1;for(i=l,y=0;y<a.length;++y)u[i]=a[y],i+=1;return u.length=s-f+h,k}},!ii||!ri);var or=!{toString:null}.propertyIsEnumerable("toString"),sr=function(){}.propertyIsEnumerable("prototype"),hr=!p("x","0"),ui=function(n){var t=n.constructor;return t&&t.prototype===n},cr=["window","console","parent","self","frames"],lr=function(){if(typeof window=="undefined")return!1;for(var n in window)if(cr.indexOf(n)===-1&&p(window,n)&&window[n]!==null&&typeof window[n]=="object")try{ui(window[n])}catch(t){return!0}return!1}(),fi=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],ar=fi.length,ei=function(n){var i=bt(n),t=i==="[object Arguments]";return t||(t=!st(n)&&n!==null&&typeof n=="object"&&typeof n.length=="number"&&n.length>=0&&u(n.callee)),t};i(e,{keys:function(n){var l=u(n),c=ei(n),a=n!==null&&typeof n=="object",w=a&&h(n),t,v,i,r,y,f,e;if(!a&&!l&&!c)throw new TypeError("Object.keys called on a non-object");if(t=[],v=sr&&l,w&&hr||c)for(i=0;i<n.length;++i)s.call(t,o(i));if(!c)for(r in n)v&&r==="prototype"||!p(n,r)||s.call(t,o(r));if(or)for(y=lr||ui(n),f=0;f<ar;f++)e=fi[f],y&&e==="constructor"||!p(n,e)||s.call(t,e);return t}});oi=e.keys&&function(){return e.keys(arguments).length===2}(1,2);lt=e.keys;i(e,{keys:function(n){return ei(n)?lt(v.call(n)):lt(n)}},!oi);var si=-621987552e5,hi="-000001",vr=Date.prototype.toISOString&&new Date(si).toISOString().indexOf(hi)===-1,yr=Date.prototype.toISOString&&new Date(-1).toISOString()!=="1969-12-31T23:59:59.999Z";i(Date.prototype,{toISOString:function(){var t,r,u,n,i;if(!isFinite(this))throw new RangeError("Date.prototype.toISOString called on non-finite value.");for(n=this.getUTCFullYear(),i=this.getUTCMonth(),n+=Math.floor(i/12),i=(i%12+12)%12,t=[i+1,this.getUTCDate(),this.getUTCHours(),this.getUTCMinutes(),this.getUTCSeconds()],n=(n<0?"-":n>9999?"+":"")+a("00000"+Math.abs(n),0<=n&&n<=9999?-4:-6),r=t.length;r--;)u=t[r],u<10&&(t[r]="0"+u);return n+"-"+v.call(t,0,2).join("-")+"T"+v.call(t,2).join(":")+"."+a("000"+this.getUTCMilliseconds(),-3)+"Z"}},vr||yr);ci=function(){try{return Date.prototype.toJSON&&new Date(NaN).toJSON()===null&&new Date(si).toJSON().indexOf(hi)!==-1&&Date.prototype.toJSON.call({toISOString:function(){return!0}})}catch(n){return!1}}();ci||(Date.prototype.toJSON=function(){var n=e(this),i=r.ToPrimitive(n),t;if(typeof i=="number"&&!isFinite(i))return null;if(t=n.toISOString,!u(t))throw new TypeError("toISOString property is not callable");return t.call(n)});var pr=Date.parse("+033658-09-27T01:46:40.000Z")===1e15,wr=!isNaN(Date.parse("2012-04-04T24:00:00.500Z"))||!isNaN(Date.parse("2012-11-31T23:59:59.000Z"))||!isNaN(Date.parse("2012-12-31T23:59:60.000Z")),br=isNaN(Date.parse("2000-01-01T00:00:00.000Z"));(!Date.parse||br||wr||!pr)&&(Date=function(n){var t=function(r,u,f,e,s,h,c){var l=arguments.length,a;return a=this instanceof n?l===1&&o(r)===r?new n(t.parse(r)):l>=7?new n(r,u,f,e,s,h,c):l>=6?new n(r,u,f,e,s,h):l>=5?new n(r,u,f,e,s):l>=4?new n(r,u,f,e):l>=3?new n(r,u,f):l>=2?new n(r,u):l>=1?new n(r):new n:n.apply(this,arguments),i(a,{constructor:t},!0),a},s=new RegExp("^(\\d{4}|[+-]\\d{6})(?:-(\\d{2})(?:-(\\d{2})(?:T(\\d{2}):(\\d{2})(?::(\\d{2})(?:(\\.\\d{1,}))?)?(Z|(?:([-+])(\\d{2}):(\\d{2})))?)?)?)?$"),h=[0,31,59,90,120,151,181,212,243,273,304,334,365],u=function(n,t){var i=t>1?1:0;return h[t]+Math.floor((n-1969+i)/4)-Math.floor((n-1901+i)/100)+Math.floor((n-1601+i)/400)+365*(n-1970)},c=function(t){return f(new n(1970,0,1,0,0,0,t))},r,e;for(r in n)p(n,r)&&(t[r]=n[r]);return i(t,{now:n.now,UTC:n.UTC},!0),t.prototype=n.prototype,i(t.prototype,{constructor:t},!0),e=function(t){var i=s.exec(t);if(i){var o=f(i[1]),e=f(i[2]||1)-1,h=f(i[3]||1)-1,y=f(i[4]||0),l=f(i[5]||0),a=f(i[6]||0),v=Math.floor(f(i[7]||0)*1e3),k=Boolean(i[4]&&!i[8]),p=i[9]==="-"?1:-1,w=f(i[10]||0),b=f(i[11]||0),r;return y<(l>0||a>0||v>0?24:25)&&l<60&&a<60&&v<1e3&&e>-1&&e<12&&w<24&&b<60&&h>-1&&h<u(o,e+1)-u(o,e)&&(r=((u(o,e)+h)*24+y+w*p)*60,r=((r+l+b*p)*60+a)*1e3+v,k&&(r=c(r)),-864e13<=r&&r<=864e13)?r:NaN}return n.parse.apply(this,arguments)},i(t,{parse:e}),t}(Date));Date.now||(Date.now=function(){return(new Date).getTime()});li=yt.toFixed&&(8e-5.toFixed(3)!=="0.000"||.9.toFixed(0)!=="1"||1.255.toFixed(2)!=="1.25"||1000000000000000128..toFixed(0)!=="1000000000000000128");t={base:1e7,size:6,data:[0,0,0,0,0,0],multiply:function(n,i){for(var u=-1,r=i;++u<t.size;)r+=n*t.data[u],t.data[u]=r%t.base,r=Math.floor(r/t.base)},divide:function(n){for(var r=t.size,i=0;--r>=0;)i+=t.data[r],t.data[r]=Math.floor(i/n),i=i%n*t.base},numToString:function(){for(var i=t.size,n="",r;--i>=0;)(n!==""||i===0||t.data[i]!==0)&&(r=o(t.data[i]),n===""?n=r:n+=a("0000000",0,7-r.length)+r);return n},pow:function ai(n,t,i){return t===0?i:t%2==1?ai(n,t-1,i*n):ai(n*n,t/2,i)},log:function(n){for(var i=0,t=n;t>=4096;)i+=12,t/=4096;while(t>=2)i+=1,t/=2;return i}};i(yt,{toFixed:function(n){var i,r,h,u,e,l,s,c;if(i=f(n),i=i!==i?0:Math.floor(i),i<0||i>20)throw new RangeError("Number.toFixed called with invalid number of decimals");if(r=f(this),r!==r)return"NaN";if(r<=-1e21||r>=1e21)return o(r);if(h="",r<0&&(h="-",r=-r),u="0",r>1e-21)if(e=t.log(r*t.pow(2,69,1))-69,l=e<0?r*t.pow(2,-e,1):r/t.pow(2,e,1),l*=4503599627370496,e=52-e,e>0){for(t.multiply(0,l),s=i;s>=7;)t.multiply(1e7,0),s-=7;for(t.multiply(t.pow(10,s,1),0),s=e-1;s>=23;)t.divide(8388608),s-=23;t.divide(1<<s);t.multiply(1,1);t.divide(2);u=t.numToString()}else t.multiply(0,l),t.multiply(1<<-e,0),u=t.numToString()+a("0.00000000000000000000",2,2+i);return i>0?(c=u.length,u=c<=i?h+a("0.0000000000000000000",0,i-c+2)+u:h+a(u,0,c-i)+"."+a(u,c-i)):u=h+u,u}},li);"ab".split(/(?:ab)*/).length!==2||".".split(/(.?)(.?)/).length!==4||"tesst".split(/(s)*/)[1]==="t"||"test".split(/(?:)/,-1).length!==4||"".split(/.?/).length||".".split(/()()/).length>1?function(){var n=typeof/()??/.exec("")[1]=="undefined";l.split=function(t,i){var e=this,l;if(typeof t=="undefined"&&i===0)return[];if(!ft(t))return c(this,t,i);var f=[],p=(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.extended?"x":"")+(t.sticky?"y":""),h=0,w,u,y,b,o=new RegExp(t.source,p+"g");for(e+="",n||(w=new RegExp("^"+o.source+"$(?!\\s)",p)),l=typeof i=="undefined"?-1>>>0:r.ToUint32(i),u=o.exec(e);u;){if(y=u.index+u[0].length,y>h&&(s.call(f,a(e,h,u.index)),!n&&u.length>1&&u[0].replace(w,function(){for(var n=1;n<arguments.length-2;n++)typeof arguments[n]=="undefined"&&(u[n]=void 0)}),u.length>1&&u.index<e.length&&s.apply(f,v.call(u,1)),b=u[0].length,h=y,f.length>=l))break;o.lastIndex===u.index&&o.lastIndex++;u=o.exec(e)}return h===e.length?(b||!o.test(""))&&s.call(f,""):s.call(f,a(e,h)),f.length>l?a(f,0,l):f}}():"0".split(void 0,0).length&&(l.split=function(n,t){return typeof n=="undefined"&&t===0?[]:c(this,n,t)});at=l.replace;vi=function(){var n=[];return"x".replace(/x(.)?/g,function(t,i){s.call(n,i)}),n.length===1&&typeof n[0]=="undefined"}();vi||(l.replace=function(n,t){var r=u(t),f=ft(n)&&/\)[*?]/.test(n.source),i;return r&&f?(i=function(i){var u=arguments.length,f=n.lastIndex,r;return n.lastIndex=0,r=n.exec(i)||[],n.lastIndex=f,s.call(r,arguments[u-2],arguments[u-1]),t.apply(this,r)},at.call(this,n,i)):at.call(this,n,t)});yi=l.substr;pi="".substr&&"0b".substr(-1)!=="b";i(l,{substr:function(n,t){var i=n;return n<0&&(i=w(this.length+n,0)),yi.call(this,i,t)}},pi);var nt="\t\n\x0b\f\r   ᠎             　\u2028\u2029﻿",tt="["+nt+"]",kr=new RegExp("^"+tt+tt+"*"),dr=new RegExp(tt+tt+"*$"),gr=l.trim&&(nt.trim()||!"​".trim());i(l,{trim:function(){if(typeof this=="undefined"||this===null)throw new TypeError("can't convert "+this+" to object");return o(this).replace(kr,"").replace(dr,"")}},gr);(parseInt(nt+"08")!==8||parseInt(nt+"0x16")!==22)&&(parseInt=function(n){var t=/^0[xX]/;return function(i,r){var u=o(i).trim(),e=f(r)||(t.test(u)?16:10);return n(u,e)}}(parseInt))});
//# sourceMappingURL=es5.shim.min.js.map
;
!function () { "use strict"; var bind = function (a, b) { var c = Array.prototype.slice.call(arguments, 2); return function () { var d = c.concat(Array.prototype.slice.call(arguments, 0)); a.apply(b, d) } }; window.console || (window.console = {}); var console = window.console; if (!console.log) if (window.log4javascript) { var log = log4javascript.getDefaultLogger(); console.log = bind(log.info, log), console.debug = bind(log.debug, log), console.info = bind(log.info, log), console.warn = bind(log.warn, log), console.error = bind(log.error, log) } else console.log = function () { }; if (console.debug || (console.debug = console.log), console.info || (console.info = console.log), console.warn || (console.warn = console.log), console.error || (console.error = console.log), null != window.__consoleShimTest__ || eval("/*@cc_on @_jscript_version <= 9@*/")) { var wrap = function (a) { var b, c, d, e; if (a = Array.prototype.slice.call(arguments, 0), e = a.shift(), c = a.length, c > 1 && window.__consoleShimTest__ !== !1) for ("string" != typeof a[0] && (a.unshift("%o"), c += 1), d = a[0].match(/%[a-z]/g), b = d ? d.length + 1 : 1; c > b; b += 1) a[0] += " %o"; Function.apply.call(e, console, a) }; console.log = bind(wrap, window, console.log), console.debug = bind(wrap, window, console.debug), console.info = bind(wrap, window, console.info), console.warn = bind(wrap, window, console.warn), console.error = bind(wrap, window, console.error) } if (console.assert || (console.assert = function () { var a = Array.prototype.slice.call(arguments, 0), b = a.shift(); b || (a[0] = "Assertion failed: " + a[0], console.error.apply(console, a)) }), console.dir || (console.dir = console.log), console.dirxml || (console.dirxml = console.log), console.exception || (console.exception = console.error), !console.time || !console.timeEnd) { var timers = {}; console.time = function (a) { timers[a] = (new Date).getTime() }, console.timeEnd = function (a) { var b = timers[a]; b && (console.log(a + ": " + ((new Date).getTime() - b) + "ms"), delete timers[a]) } } console.table || (console.table = function (a, b) { var c, d, e, f, g, h; if (a && a instanceof Array && a.length) { if (!(b && b instanceof Array)) { b = []; for (h in a[0]) a[0].hasOwnProperty(h) && b.push(h) } for (c = 0, d = a.length; d > c; c += 1) { for (e = [], f = 0, g = b.length; g > f; f += 1) e.push(a[c][b[f]]); Function.apply.call(console.log, console, e) } } }), console.clear || (console.clear = function () { }), console.trace || (console.trace = function () { }), console.group || (console.group = function () { }), console.groupCollapsed || (console.groupCollapsed = function () { }), console.groupEnd || (console.groupEnd = function () { }), console.timeStamp || (console.timeStamp = function () { }), console.profile || (console.profile = function () { }), console.profileEnd || (console.profileEnd = function () { }), console.count || (console.count = function () { }) }();
//# sourceMappingURL=consoleshim.min.map;
//     Underscore.js 1.7.0
//     http://underscorejs.org
//     (c) 2009-2014 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
//     Underscore may be freely distributed under the MIT license.
(function () { var n = this, t = n._, r = Array.prototype, e = Object.prototype, u = Function.prototype, i = r.push, a = r.slice, o = r.concat, l = e.toString, c = e.hasOwnProperty, f = Array.isArray, s = Object.keys, p = u.bind, h = function (n) { return n instanceof h ? n : this instanceof h ? void (this._wrapped = n) : new h(n) }; "undefined" != typeof exports ? ("undefined" != typeof module && module.exports && (exports = module.exports = h), exports._ = h) : n._ = h, h.VERSION = "1.7.0"; var g = function (n, t, r) { if (t === void 0) return n; switch (null == r ? 3 : r) { case 1: return function (r) { return n.call(t, r) }; case 2: return function (r, e) { return n.call(t, r, e) }; case 3: return function (r, e, u) { return n.call(t, r, e, u) }; case 4: return function (r, e, u, i) { return n.call(t, r, e, u, i) } } return function () { return n.apply(t, arguments) } }; h.iteratee = function (n, t, r) { return null == n ? h.identity : h.isFunction(n) ? g(n, t, r) : h.isObject(n) ? h.matches(n) : h.property(n) }, h.each = h.forEach = function (n, t, r) { if (null == n) return n; t = g(t, r); var e, u = n.length; if (u === +u) for (e = 0; u > e; e++) t(n[e], e, n); else { var i = h.keys(n); for (e = 0, u = i.length; u > e; e++) t(n[i[e]], i[e], n) } return n }, h.map = h.collect = function (n, t, r) { if (null == n) return []; t = h.iteratee(t, r); for (var e, u = n.length !== +n.length && h.keys(n), i = (u || n).length, a = Array(i), o = 0; i > o; o++) e = u ? u[o] : o, a[o] = t(n[e], e, n); return a }; var v = "Reduce of empty array with no initial value"; h.reduce = h.foldl = h.inject = function (n, t, r, e) { null == n && (n = []), t = g(t, e, 4); var u, i = n.length !== +n.length && h.keys(n), a = (i || n).length, o = 0; if (arguments.length < 3) { if (!a) throw new TypeError(v); r = n[i ? i[o++] : o++] } for (; a > o; o++) u = i ? i[o] : o, r = t(r, n[u], u, n); return r }, h.reduceRight = h.foldr = function (n, t, r, e) { null == n && (n = []), t = g(t, e, 4); var u, i = n.length !== +n.length && h.keys(n), a = (i || n).length; if (arguments.length < 3) { if (!a) throw new TypeError(v); r = n[i ? i[--a] : --a] } for (; a--;) u = i ? i[a] : a, r = t(r, n[u], u, n); return r }, h.find = h.detect = function (n, t, r) { var e; return t = h.iteratee(t, r), h.some(n, function (n, r, u) { return t(n, r, u) ? (e = n, !0) : void 0 }), e }, h.filter = h.select = function (n, t, r) { var e = []; return null == n ? e : (t = h.iteratee(t, r), h.each(n, function (n, r, u) { t(n, r, u) && e.push(n) }), e) }, h.reject = function (n, t, r) { return h.filter(n, h.negate(h.iteratee(t)), r) }, h.every = h.all = function (n, t, r) { if (null == n) return !0; t = h.iteratee(t, r); var e, u, i = n.length !== +n.length && h.keys(n), a = (i || n).length; for (e = 0; a > e; e++) if (u = i ? i[e] : e, !t(n[u], u, n)) return !1; return !0 }, h.some = h.any = function (n, t, r) { if (null == n) return !1; t = h.iteratee(t, r); var e, u, i = n.length !== +n.length && h.keys(n), a = (i || n).length; for (e = 0; a > e; e++) if (u = i ? i[e] : e, t(n[u], u, n)) return !0; return !1 }, h.contains = h.include = function (n, t) { return null == n ? !1 : (n.length !== +n.length && (n = h.values(n)), h.indexOf(n, t) >= 0) }, h.invoke = function (n, t) { var r = a.call(arguments, 2), e = h.isFunction(t); return h.map(n, function (n) { return (e ? t : n[t]).apply(n, r) }) }, h.pluck = function (n, t) { return h.map(n, h.property(t)) }, h.where = function (n, t) { return h.filter(n, h.matches(t)) }, h.findWhere = function (n, t) { return h.find(n, h.matches(t)) }, h.max = function (n, t, r) { var e, u, i = -1 / 0, a = -1 / 0; if (null == t && null != n) { n = n.length === +n.length ? n : h.values(n); for (var o = 0, l = n.length; l > o; o++) e = n[o], e > i && (i = e) } else t = h.iteratee(t, r), h.each(n, function (n, r, e) { u = t(n, r, e), (u > a || u === -1 / 0 && i === -1 / 0) && (i = n, a = u) }); return i }, h.min = function (n, t, r) { var e, u, i = 1 / 0, a = 1 / 0; if (null == t && null != n) { n = n.length === +n.length ? n : h.values(n); for (var o = 0, l = n.length; l > o; o++) e = n[o], i > e && (i = e) } else t = h.iteratee(t, r), h.each(n, function (n, r, e) { u = t(n, r, e), (a > u || 1 / 0 === u && 1 / 0 === i) && (i = n, a = u) }); return i }, h.shuffle = function (n) { for (var t, r = n && n.length === +n.length ? n : h.values(n), e = r.length, u = Array(e), i = 0; e > i; i++) t = h.random(0, i), t !== i && (u[i] = u[t]), u[t] = r[i]; return u }, h.sample = function (n, t, r) { return null == t || r ? (n.length !== +n.length && (n = h.values(n)), n[h.random(n.length - 1)]) : h.shuffle(n).slice(0, Math.max(0, t)) }, h.sortBy = function (n, t, r) { return t = h.iteratee(t, r), h.pluck(h.map(n, function (n, r, e) { return { value: n, index: r, criteria: t(n, r, e) } }).sort(function (n, t) { var r = n.criteria, e = t.criteria; if (r !== e) { if (r > e || r === void 0) return 1; if (e > r || e === void 0) return -1 } return n.index - t.index }), "value") }; var m = function (n) { return function (t, r, e) { var u = {}; return r = h.iteratee(r, e), h.each(t, function (e, i) { var a = r(e, i, t); n(u, e, a) }), u } }; h.groupBy = m(function (n, t, r) { h.has(n, r) ? n[r].push(t) : n[r] = [t] }), h.indexBy = m(function (n, t, r) { n[r] = t }), h.countBy = m(function (n, t, r) { h.has(n, r) ? n[r]++ : n[r] = 1 }), h.sortedIndex = function (n, t, r, e) { r = h.iteratee(r, e, 1); for (var u = r(t), i = 0, a = n.length; a > i;) { var o = i + a >>> 1; r(n[o]) < u ? i = o + 1 : a = o } return i }, h.toArray = function (n) { return n ? h.isArray(n) ? a.call(n) : n.length === +n.length ? h.map(n, h.identity) : h.values(n) : [] }, h.size = function (n) { return null == n ? 0 : n.length === +n.length ? n.length : h.keys(n).length }, h.partition = function (n, t, r) { t = h.iteratee(t, r); var e = [], u = []; return h.each(n, function (n, r, i) { (t(n, r, i) ? e : u).push(n) }), [e, u] }, h.first = h.head = h.take = function (n, t, r) { return null == n ? void 0 : null == t || r ? n[0] : 0 > t ? [] : a.call(n, 0, t) }, h.initial = function (n, t, r) { return a.call(n, 0, Math.max(0, n.length - (null == t || r ? 1 : t))) }, h.last = function (n, t, r) { return null == n ? void 0 : null == t || r ? n[n.length - 1] : a.call(n, Math.max(n.length - t, 0)) }, h.rest = h.tail = h.drop = function (n, t, r) { return a.call(n, null == t || r ? 1 : t) }, h.compact = function (n) { return h.filter(n, h.identity) }; var y = function (n, t, r, e) { if (t && h.every(n, h.isArray)) return o.apply(e, n); for (var u = 0, a = n.length; a > u; u++) { var l = n[u]; h.isArray(l) || h.isArguments(l) ? t ? i.apply(e, l) : y(l, t, r, e) : r || e.push(l) } return e }; h.flatten = function (n, t) { return y(n, t, !1, []) }, h.without = function (n) { return h.difference(n, a.call(arguments, 1)) }, h.uniq = h.unique = function (n, t, r, e) { if (null == n) return []; h.isBoolean(t) || (e = r, r = t, t = !1), null != r && (r = h.iteratee(r, e)); for (var u = [], i = [], a = 0, o = n.length; o > a; a++) { var l = n[a]; if (t) a && i === l || u.push(l), i = l; else if (r) { var c = r(l, a, n); h.indexOf(i, c) < 0 && (i.push(c), u.push(l)) } else h.indexOf(u, l) < 0 && u.push(l) } return u }, h.union = function () { return h.uniq(y(arguments, !0, !0, [])) }, h.intersection = function (n) { if (null == n) return []; for (var t = [], r = arguments.length, e = 0, u = n.length; u > e; e++) { var i = n[e]; if (!h.contains(t, i)) { for (var a = 1; r > a && h.contains(arguments[a], i) ; a++); a === r && t.push(i) } } return t }, h.difference = function (n) { var t = y(a.call(arguments, 1), !0, !0, []); return h.filter(n, function (n) { return !h.contains(t, n) }) }, h.zip = function (n) { if (null == n) return []; for (var t = h.max(arguments, "length").length, r = Array(t), e = 0; t > e; e++) r[e] = h.pluck(arguments, e); return r }, h.object = function (n, t) { if (null == n) return {}; for (var r = {}, e = 0, u = n.length; u > e; e++) t ? r[n[e]] = t[e] : r[n[e][0]] = n[e][1]; return r }, h.indexOf = function (n, t, r) { if (null == n) return -1; var e = 0, u = n.length; if (r) { if ("number" != typeof r) return e = h.sortedIndex(n, t), n[e] === t ? e : -1; e = 0 > r ? Math.max(0, u + r) : r } for (; u > e; e++) if (n[e] === t) return e; return -1 }, h.lastIndexOf = function (n, t, r) { if (null == n) return -1; var e = n.length; for ("number" == typeof r && (e = 0 > r ? e + r + 1 : Math.min(e, r + 1)) ; --e >= 0;) if (n[e] === t) return e; return -1 }, h.range = function (n, t, r) { arguments.length <= 1 && (t = n || 0, n = 0), r = r || 1; for (var e = Math.max(Math.ceil((t - n) / r), 0), u = Array(e), i = 0; e > i; i++, n += r) u[i] = n; return u }; var d = function () { }; h.bind = function (n, t) { var r, e; if (p && n.bind === p) return p.apply(n, a.call(arguments, 1)); if (!h.isFunction(n)) throw new TypeError("Bind must be called on a function"); return r = a.call(arguments, 2), e = function () { if (!(this instanceof e)) return n.apply(t, r.concat(a.call(arguments))); d.prototype = n.prototype; var u = new d; d.prototype = null; var i = n.apply(u, r.concat(a.call(arguments))); return h.isObject(i) ? i : u } }, h.partial = function (n) { var t = a.call(arguments, 1); return function () { for (var r = 0, e = t.slice(), u = 0, i = e.length; i > u; u++) e[u] === h && (e[u] = arguments[r++]); for (; r < arguments.length;) e.push(arguments[r++]); return n.apply(this, e) } }, h.bindAll = function (n) { var t, r, e = arguments.length; if (1 >= e) throw new Error("bindAll must be passed function names"); for (t = 1; e > t; t++) r = arguments[t], n[r] = h.bind(n[r], n); return n }, h.memoize = function (n, t) { var r = function (e) { var u = r.cache, i = t ? t.apply(this, arguments) : e; return h.has(u, i) || (u[i] = n.apply(this, arguments)), u[i] }; return r.cache = {}, r }, h.delay = function (n, t) { var r = a.call(arguments, 2); return setTimeout(function () { return n.apply(null, r) }, t) }, h.defer = function (n) { return h.delay.apply(h, [n, 1].concat(a.call(arguments, 1))) }, h.throttle = function (n, t, r) { var e, u, i, a = null, o = 0; r || (r = {}); var l = function () { o = r.leading === !1 ? 0 : h.now(), a = null, i = n.apply(e, u), a || (e = u = null) }; return function () { var c = h.now(); o || r.leading !== !1 || (o = c); var f = t - (c - o); return e = this, u = arguments, 0 >= f || f > t ? (clearTimeout(a), a = null, o = c, i = n.apply(e, u), a || (e = u = null)) : a || r.trailing === !1 || (a = setTimeout(l, f)), i } }, h.debounce = function (n, t, r) { var e, u, i, a, o, l = function () { var c = h.now() - a; t > c && c > 0 ? e = setTimeout(l, t - c) : (e = null, r || (o = n.apply(i, u), e || (i = u = null))) }; return function () { i = this, u = arguments, a = h.now(); var c = r && !e; return e || (e = setTimeout(l, t)), c && (o = n.apply(i, u), i = u = null), o } }, h.wrap = function (n, t) { return h.partial(t, n) }, h.negate = function (n) { return function () { return !n.apply(this, arguments) } }, h.compose = function () { var n = arguments, t = n.length - 1; return function () { for (var r = t, e = n[t].apply(this, arguments) ; r--;) e = n[r].call(this, e); return e } }, h.after = function (n, t) { return function () { return --n < 1 ? t.apply(this, arguments) : void 0 } }, h.before = function (n, t) { var r; return function () { return --n > 0 ? r = t.apply(this, arguments) : t = null, r } }, h.once = h.partial(h.before, 2), h.keys = function (n) { if (!h.isObject(n)) return []; if (s) return s(n); var t = []; for (var r in n) h.has(n, r) && t.push(r); return t }, h.values = function (n) { for (var t = h.keys(n), r = t.length, e = Array(r), u = 0; r > u; u++) e[u] = n[t[u]]; return e }, h.pairs = function (n) { for (var t = h.keys(n), r = t.length, e = Array(r), u = 0; r > u; u++) e[u] = [t[u], n[t[u]]]; return e }, h.invert = function (n) { for (var t = {}, r = h.keys(n), e = 0, u = r.length; u > e; e++) t[n[r[e]]] = r[e]; return t }, h.functions = h.methods = function (n) { var t = []; for (var r in n) h.isFunction(n[r]) && t.push(r); return t.sort() }, h.extend = function (n) { if (!h.isObject(n)) return n; for (var t, r, e = 1, u = arguments.length; u > e; e++) { t = arguments[e]; for (r in t) c.call(t, r) && (n[r] = t[r]) } return n }, h.pick = function (n, t, r) { var e, u = {}; if (null == n) return u; if (h.isFunction(t)) { t = g(t, r); for (e in n) { var i = n[e]; t(i, e, n) && (u[e] = i) } } else { var l = o.apply([], a.call(arguments, 1)); n = new Object(n); for (var c = 0, f = l.length; f > c; c++) e = l[c], e in n && (u[e] = n[e]) } return u }, h.omit = function (n, t, r) { if (h.isFunction(t)) t = h.negate(t); else { var e = h.map(o.apply([], a.call(arguments, 1)), String); t = function (n, t) { return !h.contains(e, t) } } return h.pick(n, t, r) }, h.defaults = function (n) { if (!h.isObject(n)) return n; for (var t = 1, r = arguments.length; r > t; t++) { var e = arguments[t]; for (var u in e) n[u] === void 0 && (n[u] = e[u]) } return n }, h.clone = function (n) { return h.isObject(n) ? h.isArray(n) ? n.slice() : h.extend({}, n) : n }, h.tap = function (n, t) { return t(n), n }; var b = function (n, t, r, e) { if (n === t) return 0 !== n || 1 / n === 1 / t; if (null == n || null == t) return n === t; n instanceof h && (n = n._wrapped), t instanceof h && (t = t._wrapped); var u = l.call(n); if (u !== l.call(t)) return !1; switch (u) { case "[object RegExp]": case "[object String]": return "" + n == "" + t; case "[object Number]": return +n !== +n ? +t !== +t : 0 === +n ? 1 / +n === 1 / t : +n === +t; case "[object Date]": case "[object Boolean]": return +n === +t } if ("object" != typeof n || "object" != typeof t) return !1; for (var i = r.length; i--;) if (r[i] === n) return e[i] === t; var a = n.constructor, o = t.constructor; if (a !== o && "constructor" in n && "constructor" in t && !(h.isFunction(a) && a instanceof a && h.isFunction(o) && o instanceof o)) return !1; r.push(n), e.push(t); var c, f; if ("[object Array]" === u) { if (c = n.length, f = c === t.length) for (; c-- && (f = b(n[c], t[c], r, e)) ;); } else { var s, p = h.keys(n); if (c = p.length, f = h.keys(t).length === c) for (; c-- && (s = p[c], f = h.has(t, s) && b(n[s], t[s], r, e)) ;); } return r.pop(), e.pop(), f }; h.isEqual = function (n, t) { return b(n, t, [], []) }, h.isEmpty = function (n) { if (null == n) return !0; if (h.isArray(n) || h.isString(n) || h.isArguments(n)) return 0 === n.length; for (var t in n) if (h.has(n, t)) return !1; return !0 }, h.isElement = function (n) { return !(!n || 1 !== n.nodeType) }, h.isArray = f || function (n) { return "[object Array]" === l.call(n) }, h.isObject = function (n) { var t = typeof n; return "function" === t || "object" === t && !!n }, h.each(["Arguments", "Function", "String", "Number", "Date", "RegExp"], function (n) { h["is" + n] = function (t) { return l.call(t) === "[object " + n + "]" } }), h.isArguments(arguments) || (h.isArguments = function (n) { return h.has(n, "callee") }), "function" != typeof /./ && (h.isFunction = function (n) { return "function" == typeof n || !1 }), h.isFinite = function (n) { return isFinite(n) && !isNaN(parseFloat(n)) }, h.isNaN = function (n) { return h.isNumber(n) && n !== +n }, h.isBoolean = function (n) { return n === !0 || n === !1 || "[object Boolean]" === l.call(n) }, h.isNull = function (n) { return null === n }, h.isUndefined = function (n) { return n === void 0 }, h.has = function (n, t) { return null != n && c.call(n, t) }, h.noConflict = function () { return n._ = t, this }, h.identity = function (n) { return n }, h.constant = function (n) { return function () { return n } }, h.noop = function () { }, h.property = function (n) { return function (t) { return t[n] } }, h.matches = function (n) { var t = h.pairs(n), r = t.length; return function (n) { if (null == n) return !r; n = new Object(n); for (var e = 0; r > e; e++) { var u = t[e], i = u[0]; if (u[1] !== n[i] || !(i in n)) return !1 } return !0 } }, h.times = function (n, t, r) { var e = Array(Math.max(0, n)); t = g(t, r, 1); for (var u = 0; n > u; u++) e[u] = t(u); return e }, h.random = function (n, t) { return null == t && (t = n, n = 0), n + Math.floor(Math.random() * (t - n + 1)) }, h.now = Date.now || function () { return (new Date).getTime() }; var _ = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#x27;", "`": "&#x60;" }, w = h.invert(_), j = function (n) { var t = function (t) { return n[t] }, r = "(?:" + h.keys(n).join("|") + ")", e = RegExp(r), u = RegExp(r, "g"); return function (n) { return n = null == n ? "" : "" + n, e.test(n) ? n.replace(u, t) : n } }; h.escape = j(_), h.unescape = j(w), h.result = function (n, t) { if (null == n) return void 0; var r = n[t]; return h.isFunction(r) ? n[t]() : r }; var x = 0; h.uniqueId = function (n) { var t = ++x + ""; return n ? n + t : t }, h.templateSettings = { evaluate: /<%([\s\S]+?)%>/g, interpolate: /<%=([\s\S]+?)%>/g, escape: /<%-([\s\S]+?)%>/g }; var A = /(.)^/, k = { "'": "'", "\\": "\\", "\r": "r", "\n": "n", "\u2028": "u2028", "\u2029": "u2029" }, O = /\\|'|\r|\n|\u2028|\u2029/g, F = function (n) { return "\\" + k[n] }; h.template = function (n, t, r) { !t && r && (t = r), t = h.defaults({}, t, h.templateSettings); var e = RegExp([(t.escape || A).source, (t.interpolate || A).source, (t.evaluate || A).source].join("|") + "|$", "g"), u = 0, i = "__p+='"; n.replace(e, function (t, r, e, a, o) { return i += n.slice(u, o).replace(O, F), u = o + t.length, r ? i += "'+\n((__t=(" + r + "))==null?'':_.escape(__t))+\n'" : e ? i += "'+\n((__t=(" + e + "))==null?'':__t)+\n'" : a && (i += "';\n" + a + "\n__p+='"), t }), i += "';\n", t.variable || (i = "with(obj||{}){\n" + i + "}\n"), i = "var __t,__p='',__j=Array.prototype.join," + "print=function(){__p+=__j.call(arguments,'');};\n" + i + "return __p;\n"; try { var a = new Function(t.variable || "obj", "_", i) } catch (o) { throw o.source = i, o } var l = function (n) { return a.call(this, n, h) }, c = t.variable || "obj"; return l.source = "function(" + c + "){\n" + i + "}", l }, h.chain = function (n) { var t = h(n); return t._chain = !0, t }; var E = function (n) { return this._chain ? h(n).chain() : n }; h.mixin = function (n) { h.each(h.functions(n), function (t) { var r = h[t] = n[t]; h.prototype[t] = function () { var n = [this._wrapped]; return i.apply(n, arguments), E.call(this, r.apply(h, n)) } }) }, h.mixin(h), h.each(["pop", "push", "reverse", "shift", "sort", "splice", "unshift"], function (n) { var t = r[n]; h.prototype[n] = function () { var r = this._wrapped; return t.apply(r, arguments), "shift" !== n && "splice" !== n || 0 !== r.length || delete r[0], E.call(this, r) } }), h.each(["concat", "join", "slice"], function (n) { var t = r[n]; h.prototype[n] = function () { return E.call(this, t.apply(this._wrapped, arguments)) } }), h.prototype.value = function () { return this._wrapped }, "function" == typeof define && define.amd && define("underscore", [], function () { return h }) }).call(this);
//# sourceMappingURL=underscore-min.map;
//! moment.js
//! version : 2.9.0
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
//! license : MIT
//! momentjs.com
(function (a) {
    function b(a, b, c) { switch (arguments.length) { case 2: return null != a ? a : b; case 3: return null != a ? a : null != b ? b : c; default: throw new Error("Implement me") } } function c(a, b) { return Bb.call(a, b) } function d() { return { empty: !1, unusedTokens: [], unusedInput: [], overflow: -2, charsLeftOver: 0, nullInput: !1, invalidMonth: null, invalidFormat: !1, userInvalidated: !1, iso: !1 } } function e(a) { vb.suppressDeprecationWarnings === !1 && "undefined" != typeof console && console.warn && console.warn("Deprecation warning: " + a) } function f(a, b) { var c = !0; return o(function () { return c && (e(a), c = !1), b.apply(this, arguments) }, b) } function g(a, b) { sc[a] || (e(b), sc[a] = !0) } function h(a, b) { return function (c) { return r(a.call(this, c), b) } } function i(a, b) { return function (c) { return this.localeData().ordinal(a.call(this, c), b) } } function j(a, b) { var c, d, e = 12 * (b.year() - a.year()) + (b.month() - a.month()), f = a.clone().add(e, "months"); return 0 > b - f ? (c = a.clone().add(e - 1, "months"), d = (b - f) / (f - c)) : (c = a.clone().add(e + 1, "months"), d = (b - f) / (c - f)), -(e + d) } function k(a, b, c) { var d; return null == c ? b : null != a.meridiemHour ? a.meridiemHour(b, c) : null != a.isPM ? (d = a.isPM(c), d && 12 > b && (b += 12), d || 12 !== b || (b = 0), b) : b } function l() { } function m(a, b) { b !== !1 && H(a), p(this, a), this._d = new Date(+a._d), uc === !1 && (uc = !0, vb.updateOffset(this), uc = !1) } function n(a) { var b = A(a), c = b.year || 0, d = b.quarter || 0, e = b.month || 0, f = b.week || 0, g = b.day || 0, h = b.hour || 0, i = b.minute || 0, j = b.second || 0, k = b.millisecond || 0; this._milliseconds = +k + 1e3 * j + 6e4 * i + 36e5 * h, this._days = +g + 7 * f, this._months = +e + 3 * d + 12 * c, this._data = {}, this._locale = vb.localeData(), this._bubble() } function o(a, b) { for (var d in b) c(b, d) && (a[d] = b[d]); return c(b, "toString") && (a.toString = b.toString), c(b, "valueOf") && (a.valueOf = b.valueOf), a } function p(a, b) { var c, d, e; if ("undefined" != typeof b._isAMomentObject && (a._isAMomentObject = b._isAMomentObject), "undefined" != typeof b._i && (a._i = b._i), "undefined" != typeof b._f && (a._f = b._f), "undefined" != typeof b._l && (a._l = b._l), "undefined" != typeof b._strict && (a._strict = b._strict), "undefined" != typeof b._tzm && (a._tzm = b._tzm), "undefined" != typeof b._isUTC && (a._isUTC = b._isUTC), "undefined" != typeof b._offset && (a._offset = b._offset), "undefined" != typeof b._pf && (a._pf = b._pf), "undefined" != typeof b._locale && (a._locale = b._locale), Kb.length > 0) for (c in Kb) d = Kb[c], e = b[d], "undefined" != typeof e && (a[d] = e); return a } function q(a) { return 0 > a ? Math.ceil(a) : Math.floor(a) } function r(a, b, c) { for (var d = "" + Math.abs(a), e = a >= 0; d.length < b;) d = "0" + d; return (e ? c ? "+" : "" : "-") + d } function s(a, b) { var c = { milliseconds: 0, months: 0 }; return c.months = b.month() - a.month() + 12 * (b.year() - a.year()), a.clone().add(c.months, "M").isAfter(b) && --c.months, c.milliseconds = +b - +a.clone().add(c.months, "M"), c } function t(a, b) { var c; return b = M(b, a), a.isBefore(b) ? c = s(a, b) : (c = s(b, a), c.milliseconds = -c.milliseconds, c.months = -c.months), c } function u(a, b) { return function (c, d) { var e, f; return null === d || isNaN(+d) || (g(b, "moment()." + b + "(period, number) is deprecated. Please use moment()." + b + "(number, period)."), f = c, c = d, d = f), c = "string" == typeof c ? +c : c, e = vb.duration(c, d), v(this, e, a), this } } function v(a, b, c, d) { var e = b._milliseconds, f = b._days, g = b._months; d = null == d ? !0 : d, e && a._d.setTime(+a._d + e * c), f && pb(a, "Date", ob(a, "Date") + f * c), g && nb(a, ob(a, "Month") + g * c), d && vb.updateOffset(a, f || g) } function w(a) { return "[object Array]" === Object.prototype.toString.call(a) } function x(a) { return "[object Date]" === Object.prototype.toString.call(a) || a instanceof Date } function y(a, b, c) { var d, e = Math.min(a.length, b.length), f = Math.abs(a.length - b.length), g = 0; for (d = 0; e > d; d++) (c && a[d] !== b[d] || !c && C(a[d]) !== C(b[d])) && g++; return g + f } function z(a) { if (a) { var b = a.toLowerCase().replace(/(.)s$/, "$1"); a = lc[a] || mc[b] || b } return a } function A(a) { var b, d, e = {}; for (d in a) c(a, d) && (b = z(d), b && (e[b] = a[d])); return e } function B(b) { var c, d; if (0 === b.indexOf("week")) c = 7, d = "day"; else { if (0 !== b.indexOf("month")) return; c = 12, d = "month" } vb[b] = function (e, f) { var g, h, i = vb._locale[b], j = []; if ("number" == typeof e && (f = e, e = a), h = function (a) { var b = vb().utc().set(d, a); return i.call(vb._locale, b, e || "") }, null != f) return h(f); for (g = 0; c > g; g++) j.push(h(g)); return j } } function C(a) { var b = +a, c = 0; return 0 !== b && isFinite(b) && (c = b >= 0 ? Math.floor(b) : Math.ceil(b)), c } function D(a, b) { return new Date(Date.UTC(a, b + 1, 0)).getUTCDate() } function E(a, b, c) { return jb(vb([a, 11, 31 + b - c]), b, c).week } function F(a) { return G(a) ? 366 : 365 } function G(a) { return a % 4 === 0 && a % 100 !== 0 || a % 400 === 0 } function H(a) { var b; a._a && -2 === a._pf.overflow && (b = a._a[Db] < 0 || a._a[Db] > 11 ? Db : a._a[Eb] < 1 || a._a[Eb] > D(a._a[Cb], a._a[Db]) ? Eb : a._a[Fb] < 0 || a._a[Fb] > 24 || 24 === a._a[Fb] && (0 !== a._a[Gb] || 0 !== a._a[Hb] || 0 !== a._a[Ib]) ? Fb : a._a[Gb] < 0 || a._a[Gb] > 59 ? Gb : a._a[Hb] < 0 || a._a[Hb] > 59 ? Hb : a._a[Ib] < 0 || a._a[Ib] > 999 ? Ib : -1, a._pf._overflowDayOfYear && (Cb > b || b > Eb) && (b = Eb), a._pf.overflow = b) } function I(b) { return null == b._isValid && (b._isValid = !isNaN(b._d.getTime()) && b._pf.overflow < 0 && !b._pf.empty && !b._pf.invalidMonth && !b._pf.nullInput && !b._pf.invalidFormat && !b._pf.userInvalidated, b._strict && (b._isValid = b._isValid && 0 === b._pf.charsLeftOver && 0 === b._pf.unusedTokens.length && b._pf.bigHour === a)), b._isValid } function J(a) { return a ? a.toLowerCase().replace("_", "-") : a } function K(a) { for (var b, c, d, e, f = 0; f < a.length;) { for (e = J(a[f]).split("-"), b = e.length, c = J(a[f + 1]), c = c ? c.split("-") : null; b > 0;) { if (d = L(e.slice(0, b).join("-"))) return d; if (c && c.length >= b && y(e, c, !0) >= b - 1) break; b-- } f++ } return null } function L(a) { var b = null; if (!Jb[a] && Lb) try { b = vb.locale(), require("./locale/" + a), vb.locale(b) } catch (c) { } return Jb[a] } function M(a, b) { var c, d; return b._isUTC ? (c = b.clone(), d = (vb.isMoment(a) || x(a) ? +a : +vb(a)) - +c, c._d.setTime(+c._d + d), vb.updateOffset(c, !1), c) : vb(a).local() } function N(a) { return a.match(/\[[\s\S]/) ? a.replace(/^\[|\]$/g, "") : a.replace(/\\/g, "") } function O(a) { var b, c, d = a.match(Pb); for (b = 0, c = d.length; c > b; b++) d[b] = rc[d[b]] ? rc[d[b]] : N(d[b]); return function (e) { var f = ""; for (b = 0; c > b; b++) f += d[b] instanceof Function ? d[b].call(e, a) : d[b]; return f } } function P(a, b) { return a.isValid() ? (b = Q(b, a.localeData()), nc[b] || (nc[b] = O(b)), nc[b](a)) : a.localeData().invalidDate() } function Q(a, b) { function c(a) { return b.longDateFormat(a) || a } var d = 5; for (Qb.lastIndex = 0; d >= 0 && Qb.test(a) ;) a = a.replace(Qb, c), Qb.lastIndex = 0, d -= 1; return a } function R(a, b) { var c, d = b._strict; switch (a) { case "Q": return _b; case "DDDD": return bc; case "YYYY": case "GGGG": case "gggg": return d ? cc : Tb; case "Y": case "G": case "g": return ec; case "YYYYYY": case "YYYYY": case "GGGGG": case "ggggg": return d ? dc : Ub; case "S": if (d) return _b; case "SS": if (d) return ac; case "SSS": if (d) return bc; case "DDD": return Sb; case "MMM": case "MMMM": case "dd": case "ddd": case "dddd": return Wb; case "a": case "A": return b._locale._meridiemParse; case "x": return Zb; case "X": return $b; case "Z": case "ZZ": return Xb; case "T": return Yb; case "SSSS": return Vb; case "MM": case "DD": case "YY": case "GG": case "gg": case "HH": case "hh": case "mm": case "ss": case "ww": case "WW": return d ? ac : Rb; case "M": case "D": case "d": case "H": case "h": case "m": case "s": case "w": case "W": case "e": case "E": return Rb; case "Do": return d ? b._locale._ordinalParse : b._locale._ordinalParseLenient; default: return c = new RegExp($(Z(a.replace("\\", "")), "i")) } } function S(a) { a = a || ""; var b = a.match(Xb) || [], c = b[b.length - 1] || [], d = (c + "").match(jc) || ["-", 0, 0], e = +(60 * d[1]) + C(d[2]); return "+" === d[0] ? e : -e } function T(a, b, c) { var d, e = c._a; switch (a) { case "Q": null != b && (e[Db] = 3 * (C(b) - 1)); break; case "M": case "MM": null != b && (e[Db] = C(b) - 1); break; case "MMM": case "MMMM": d = c._locale.monthsParse(b, a, c._strict), null != d ? e[Db] = d : c._pf.invalidMonth = b; break; case "D": case "DD": null != b && (e[Eb] = C(b)); break; case "Do": null != b && (e[Eb] = C(parseInt(b.match(/\d{1,2}/)[0], 10))); break; case "DDD": case "DDDD": null != b && (c._dayOfYear = C(b)); break; case "YY": e[Cb] = vb.parseTwoDigitYear(b); break; case "YYYY": case "YYYYY": case "YYYYYY": e[Cb] = C(b); break; case "a": case "A": c._meridiem = b; break; case "h": case "hh": c._pf.bigHour = !0; case "H": case "HH": e[Fb] = C(b); break; case "m": case "mm": e[Gb] = C(b); break; case "s": case "ss": e[Hb] = C(b); break; case "S": case "SS": case "SSS": case "SSSS": e[Ib] = C(1e3 * ("0." + b)); break; case "x": c._d = new Date(C(b)); break; case "X": c._d = new Date(1e3 * parseFloat(b)); break; case "Z": case "ZZ": c._useUTC = !0, c._tzm = S(b); break; case "dd": case "ddd": case "dddd": d = c._locale.weekdaysParse(b), null != d ? (c._w = c._w || {}, c._w.d = d) : c._pf.invalidWeekday = b; break; case "w": case "ww": case "W": case "WW": case "d": case "e": case "E": a = a.substr(0, 1); case "gggg": case "GGGG": case "GGGGG": a = a.substr(0, 2), b && (c._w = c._w || {}, c._w[a] = C(b)); break; case "gg": case "GG": c._w = c._w || {}, c._w[a] = vb.parseTwoDigitYear(b) } } function U(a) { var c, d, e, f, g, h, i; c = a._w, null != c.GG || null != c.W || null != c.E ? (g = 1, h = 4, d = b(c.GG, a._a[Cb], jb(vb(), 1, 4).year), e = b(c.W, 1), f = b(c.E, 1)) : (g = a._locale._week.dow, h = a._locale._week.doy, d = b(c.gg, a._a[Cb], jb(vb(), g, h).year), e = b(c.w, 1), null != c.d ? (f = c.d, g > f && ++e) : f = null != c.e ? c.e + g : g), i = kb(d, e, f, h, g), a._a[Cb] = i.year, a._dayOfYear = i.dayOfYear } function V(a) { var c, d, e, f, g = []; if (!a._d) { for (e = X(a), a._w && null == a._a[Eb] && null == a._a[Db] && U(a), a._dayOfYear && (f = b(a._a[Cb], e[Cb]), a._dayOfYear > F(f) && (a._pf._overflowDayOfYear = !0), d = fb(f, 0, a._dayOfYear), a._a[Db] = d.getUTCMonth(), a._a[Eb] = d.getUTCDate()), c = 0; 3 > c && null == a._a[c]; ++c) a._a[c] = g[c] = e[c]; for (; 7 > c; c++) a._a[c] = g[c] = null == a._a[c] ? 2 === c ? 1 : 0 : a._a[c]; 24 === a._a[Fb] && 0 === a._a[Gb] && 0 === a._a[Hb] && 0 === a._a[Ib] && (a._nextDay = !0, a._a[Fb] = 0), a._d = (a._useUTC ? fb : eb).apply(null, g), null != a._tzm && a._d.setUTCMinutes(a._d.getUTCMinutes() - a._tzm), a._nextDay && (a._a[Fb] = 24) } } function W(a) { var b; a._d || (b = A(a._i), a._a = [b.year, b.month, b.day || b.date, b.hour, b.minute, b.second, b.millisecond], V(a)) } function X(a) { var b = new Date; return a._useUTC ? [b.getUTCFullYear(), b.getUTCMonth(), b.getUTCDate()] : [b.getFullYear(), b.getMonth(), b.getDate()] } function Y(b) { if (b._f === vb.ISO_8601) return void ab(b); b._a = [], b._pf.empty = !0; var c, d, e, f, g, h = "" + b._i, i = h.length, j = 0; for (e = Q(b._f, b._locale).match(Pb) || [], c = 0; c < e.length; c++) f = e[c], d = (h.match(R(f, b)) || [])[0], d && (g = h.substr(0, h.indexOf(d)), g.length > 0 && b._pf.unusedInput.push(g), h = h.slice(h.indexOf(d) + d.length), j += d.length), rc[f] ? (d ? b._pf.empty = !1 : b._pf.unusedTokens.push(f), T(f, d, b)) : b._strict && !d && b._pf.unusedTokens.push(f); b._pf.charsLeftOver = i - j, h.length > 0 && b._pf.unusedInput.push(h), b._pf.bigHour === !0 && b._a[Fb] <= 12 && (b._pf.bigHour = a), b._a[Fb] = k(b._locale, b._a[Fb], b._meridiem), V(b), H(b) } function Z(a) { return a.replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (a, b, c, d, e) { return b || c || d || e }) } function $(a) { return a.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&") } function _(a) { var b, c, e, f, g; if (0 === a._f.length) return a._pf.invalidFormat = !0, void (a._d = new Date(0 / 0)); for (f = 0; f < a._f.length; f++) g = 0, b = p({}, a), null != a._useUTC && (b._useUTC = a._useUTC), b._pf = d(), b._f = a._f[f], Y(b), I(b) && (g += b._pf.charsLeftOver, g += 10 * b._pf.unusedTokens.length, b._pf.score = g, (null == e || e > g) && (e = g, c = b)); o(a, c || b) } function ab(a) { var b, c, d = a._i, e = fc.exec(d); if (e) { for (a._pf.iso = !0, b = 0, c = hc.length; c > b; b++) if (hc[b][1].exec(d)) { a._f = hc[b][0] + (e[6] || " "); break } for (b = 0, c = ic.length; c > b; b++) if (ic[b][1].exec(d)) { a._f += ic[b][0]; break } d.match(Xb) && (a._f += "Z"), Y(a) } else a._isValid = !1 } function bb(a) { ab(a), a._isValid === !1 && (delete a._isValid, vb.createFromInputFallback(a)) } function cb(a, b) { var c, d = []; for (c = 0; c < a.length; ++c) d.push(b(a[c], c)); return d } function db(b) { var c, d = b._i; d === a ? b._d = new Date : x(d) ? b._d = new Date(+d) : null !== (c = Mb.exec(d)) ? b._d = new Date(+c[1]) : "string" == typeof d ? bb(b) : w(d) ? (b._a = cb(d.slice(0), function (a) { return parseInt(a, 10) }), V(b)) : "object" == typeof d ? W(b) : "number" == typeof d ? b._d = new Date(d) : vb.createFromInputFallback(b) } function eb(a, b, c, d, e, f, g) { var h = new Date(a, b, c, d, e, f, g); return 1970 > a && h.setFullYear(a), h } function fb(a) { var b = new Date(Date.UTC.apply(null, arguments)); return 1970 > a && b.setUTCFullYear(a), b } function gb(a, b) { if ("string" == typeof a) if (isNaN(a)) { if (a = b.weekdaysParse(a), "number" != typeof a) return null } else a = parseInt(a, 10); return a } function hb(a, b, c, d, e) { return e.relativeTime(b || 1, !!c, a, d) } function ib(a, b, c) { var d = vb.duration(a).abs(), e = Ab(d.as("s")), f = Ab(d.as("m")), g = Ab(d.as("h")), h = Ab(d.as("d")), i = Ab(d.as("M")), j = Ab(d.as("y")), k = e < oc.s && ["s", e] || 1 === f && ["m"] || f < oc.m && ["mm", f] || 1 === g && ["h"] || g < oc.h && ["hh", g] || 1 === h && ["d"] || h < oc.d && ["dd", h] || 1 === i && ["M"] || i < oc.M && ["MM", i] || 1 === j && ["y"] || ["yy", j]; return k[2] = b, k[3] = +a > 0, k[4] = c, hb.apply({}, k) } function jb(a, b, c) { var d, e = c - b, f = c - a.day(); return f > e && (f -= 7), e - 7 > f && (f += 7), d = vb(a).add(f, "d"), { week: Math.ceil(d.dayOfYear() / 7), year: d.year() } } function kb(a, b, c, d, e) { var f, g, h = fb(a, 0, 1).getUTCDay(); return h = 0 === h ? 7 : h, c = null != c ? c : e, f = e - h + (h > d ? 7 : 0) - (e > h ? 7 : 0), g = 7 * (b - 1) + (c - e) + f + 1, { year: g > 0 ? a : a - 1, dayOfYear: g > 0 ? g : F(a - 1) + g } } function lb(b) { var c, d = b._i, e = b._f; return b._locale = b._locale || vb.localeData(b._l), null === d || e === a && "" === d ? vb.invalid({ nullInput: !0 }) : ("string" == typeof d && (b._i = d = b._locale.preparse(d)), vb.isMoment(d) ? new m(d, !0) : (e ? w(e) ? _(b) : Y(b) : db(b), c = new m(b), c._nextDay && (c.add(1, "d"), c._nextDay = a), c)) } function mb(a, b) { var c, d; if (1 === b.length && w(b[0]) && (b = b[0]), !b.length) return vb(); for (c = b[0], d = 1; d < b.length; ++d) b[d][a](c) && (c = b[d]); return c } function nb(a, b) { var c; return "string" == typeof b && (b = a.localeData().monthsParse(b), "number" != typeof b) ? a : (c = Math.min(a.date(), D(a.year(), b)), a._d["set" + (a._isUTC ? "UTC" : "") + "Month"](b, c), a) } function ob(a, b) { return a._d["get" + (a._isUTC ? "UTC" : "") + b]() } function pb(a, b, c) { return "Month" === b ? nb(a, c) : a._d["set" + (a._isUTC ? "UTC" : "") + b](c) } function qb(a, b) { return function (c) { return null != c ? (pb(this, a, c), vb.updateOffset(this, b), this) : ob(this, a) } } function rb(a) { return 400 * a / 146097 } function sb(a) { return 146097 * a / 400 } function tb(a) { vb.duration.fn[a] = function () { return this._data[a] } } function ub(a) { "undefined" == typeof ender && (wb = zb.moment, zb.moment = a ? f("Accessing Moment through the global scope is deprecated, and will be removed in an upcoming release.", vb) : vb) } for (var vb, wb, xb, yb = "2.9.0", zb = "undefined" == typeof global || "undefined" != typeof window && window !== global.window ? this : global, Ab = Math.round, Bb = Object.prototype.hasOwnProperty, Cb = 0, Db = 1, Eb = 2, Fb = 3, Gb = 4, Hb = 5, Ib = 6, Jb = {}, Kb = [], Lb = "undefined" != typeof module && module && module.exports, Mb = /^\/?Date\((\-?\d+)/i, Nb = /(\-)?(?:(\d*)\.)?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/, Ob = /^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/, Pb = /(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Q|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,4}|x|X|zz?|ZZ?|.)/g, Qb = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g, Rb = /\d\d?/, Sb = /\d{1,3}/, Tb = /\d{1,4}/, Ub = /[+\-]?\d{1,6}/, Vb = /\d+/, Wb = /[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i, Xb = /Z|[\+\-]\d\d:?\d\d/gi, Yb = /T/i, Zb = /[\+\-]?\d+/, $b = /[\+\-]?\d+(\.\d{1,3})?/, _b = /\d/, ac = /\d\d/, bc = /\d{3}/, cc = /\d{4}/, dc = /[+-]?\d{6}/, ec = /[+-]?\d+/, fc = /^\s*(?:[+-]\d{6}|\d{4})-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/, gc = "YYYY-MM-DDTHH:mm:ssZ", hc = [["YYYYYY-MM-DD", /[+-]\d{6}-\d{2}-\d{2}/], ["YYYY-MM-DD", /\d{4}-\d{2}-\d{2}/], ["GGGG-[W]WW-E", /\d{4}-W\d{2}-\d/], ["GGGG-[W]WW", /\d{4}-W\d{2}/], ["YYYY-DDD", /\d{4}-\d{3}/]], ic = [["HH:mm:ss.SSSS", /(T| )\d\d:\d\d:\d\d\.\d+/], ["HH:mm:ss", /(T| )\d\d:\d\d:\d\d/], ["HH:mm", /(T| )\d\d:\d\d/], ["HH", /(T| )\d\d/]], jc = /([\+\-]|\d\d)/gi, kc = ("Date|Hours|Minutes|Seconds|Milliseconds".split("|"), { Milliseconds: 1, Seconds: 1e3, Minutes: 6e4, Hours: 36e5, Days: 864e5, Months: 2592e6, Years: 31536e6 }), lc = { ms: "millisecond", s: "second", m: "minute", h: "hour", d: "day", D: "date", w: "week", W: "isoWeek", M: "month", Q: "quarter", y: "year", DDD: "dayOfYear", e: "weekday", E: "isoWeekday", gg: "weekYear", GG: "isoWeekYear" }, mc = { dayofyear: "dayOfYear", isoweekday: "isoWeekday", isoweek: "isoWeek", weekyear: "weekYear", isoweekyear: "isoWeekYear" }, nc = {}, oc = { s: 45, m: 45, h: 22, d: 26, M: 11 }, pc = "DDD w W M D d".split(" "), qc = "M D H h m s w W".split(" "), rc = { M: function () { return this.month() + 1 }, MMM: function (a) { return this.localeData().monthsShort(this, a) }, MMMM: function (a) { return this.localeData().months(this, a) }, D: function () { return this.date() }, DDD: function () { return this.dayOfYear() }, d: function () { return this.day() }, dd: function (a) { return this.localeData().weekdaysMin(this, a) }, ddd: function (a) { return this.localeData().weekdaysShort(this, a) }, dddd: function (a) { return this.localeData().weekdays(this, a) }, w: function () { return this.week() }, W: function () { return this.isoWeek() }, YY: function () { return r(this.year() % 100, 2) }, YYYY: function () { return r(this.year(), 4) }, YYYYY: function () { return r(this.year(), 5) }, YYYYYY: function () { var a = this.year(), b = a >= 0 ? "+" : "-"; return b + r(Math.abs(a), 6) }, gg: function () { return r(this.weekYear() % 100, 2) }, gggg: function () { return r(this.weekYear(), 4) }, ggggg: function () { return r(this.weekYear(), 5) }, GG: function () { return r(this.isoWeekYear() % 100, 2) }, GGGG: function () { return r(this.isoWeekYear(), 4) }, GGGGG: function () { return r(this.isoWeekYear(), 5) }, e: function () { return this.weekday() }, E: function () { return this.isoWeekday() }, a: function () { return this.localeData().meridiem(this.hours(), this.minutes(), !0) }, A: function () { return this.localeData().meridiem(this.hours(), this.minutes(), !1) }, H: function () { return this.hours() }, h: function () { return this.hours() % 12 || 12 }, m: function () { return this.minutes() }, s: function () { return this.seconds() }, S: function () { return C(this.milliseconds() / 100) }, SS: function () { return r(C(this.milliseconds() / 10), 2) }, SSS: function () { return r(this.milliseconds(), 3) }, SSSS: function () { return r(this.milliseconds(), 3) }, Z: function () { var a = this.utcOffset(), b = "+"; return 0 > a && (a = -a, b = "-"), b + r(C(a / 60), 2) + ":" + r(C(a) % 60, 2) }, ZZ: function () { var a = this.utcOffset(), b = "+"; return 0 > a && (a = -a, b = "-"), b + r(C(a / 60), 2) + r(C(a) % 60, 2) }, z: function () { return this.zoneAbbr() }, zz: function () { return this.zoneName() }, x: function () { return this.valueOf() }, X: function () { return this.unix() }, Q: function () { return this.quarter() } }, sc = {}, tc = ["months", "monthsShort", "weekdays", "weekdaysShort", "weekdaysMin"], uc = !1; pc.length;) xb = pc.pop(), rc[xb + "o"] = i(rc[xb], xb); for (; qc.length;) xb = qc.pop(), rc[xb + xb] = h(rc[xb], 2); rc.DDDD = h(rc.DDD, 3), o(l.prototype, { set: function (a) { var b, c; for (c in a) b = a[c], "function" == typeof b ? this[c] = b : this["_" + c] = b; this._ordinalParseLenient = new RegExp(this._ordinalParse.source + "|" + /\d{1,2}/.source) }, _months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), months: function (a) { return this._months[a.month()] }, _monthsShort: "Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"), monthsShort: function (a) { return this._monthsShort[a.month()] }, monthsParse: function (a, b, c) { var d, e, f; for (this._monthsParse || (this._monthsParse = [], this._longMonthsParse = [], this._shortMonthsParse = []), d = 0; 12 > d; d++) { if (e = vb.utc([2e3, d]), c && !this._longMonthsParse[d] && (this._longMonthsParse[d] = new RegExp("^" + this.months(e, "").replace(".", "") + "$", "i"), this._shortMonthsParse[d] = new RegExp("^" + this.monthsShort(e, "").replace(".", "") + "$", "i")), c || this._monthsParse[d] || (f = "^" + this.months(e, "") + "|^" + this.monthsShort(e, ""), this._monthsParse[d] = new RegExp(f.replace(".", ""), "i")), c && "MMMM" === b && this._longMonthsParse[d].test(a)) return d; if (c && "MMM" === b && this._shortMonthsParse[d].test(a)) return d; if (!c && this._monthsParse[d].test(a)) return d } }, _weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), weekdays: function (a) { return this._weekdays[a.day()] }, _weekdaysShort: "Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"), weekdaysShort: function (a) { return this._weekdaysShort[a.day()] }, _weekdaysMin: "Su_Mo_Tu_We_Th_Fr_Sa".split("_"), weekdaysMin: function (a) { return this._weekdaysMin[a.day()] }, weekdaysParse: function (a) { var b, c, d; for (this._weekdaysParse || (this._weekdaysParse = []), b = 0; 7 > b; b++) if (this._weekdaysParse[b] || (c = vb([2e3, 1]).day(b), d = "^" + this.weekdays(c, "") + "|^" + this.weekdaysShort(c, "") + "|^" + this.weekdaysMin(c, ""), this._weekdaysParse[b] = new RegExp(d.replace(".", ""), "i")), this._weekdaysParse[b].test(a)) return b }, _longDateFormat: { LTS: "h:mm:ss A", LT: "h:mm A", L: "MM/DD/YYYY", LL: "MMMM D, YYYY", LLL: "MMMM D, YYYY LT", LLLL: "dddd, MMMM D, YYYY LT" }, longDateFormat: function (a) { var b = this._longDateFormat[a]; return !b && this._longDateFormat[a.toUpperCase()] && (b = this._longDateFormat[a.toUpperCase()].replace(/MMMM|MM|DD|dddd/g, function (a) { return a.slice(1) }), this._longDateFormat[a] = b), b }, isPM: function (a) { return "p" === (a + "").toLowerCase().charAt(0) }, _meridiemParse: /[ap]\.?m?\.?/i, meridiem: function (a, b, c) { return a > 11 ? c ? "pm" : "PM" : c ? "am" : "AM" }, _calendar: { sameDay: "[Today at] LT", nextDay: "[Tomorrow at] LT", nextWeek: "dddd [at] LT", lastDay: "[Yesterday at] LT", lastWeek: "[Last] dddd [at] LT", sameElse: "L" }, calendar: function (a, b, c) { var d = this._calendar[a]; return "function" == typeof d ? d.apply(b, [c]) : d }, _relativeTime: { future: "in %s", past: "%s ago", s: "a few seconds", m: "a minute", mm: "%d minutes", h: "an hour", hh: "%d hours", d: "a day", dd: "%d days", M: "a month", MM: "%d months", y: "a year", yy: "%d years" }, relativeTime: function (a, b, c, d) { var e = this._relativeTime[c]; return "function" == typeof e ? e(a, b, c, d) : e.replace(/%d/i, a) }, pastFuture: function (a, b) { var c = this._relativeTime[a > 0 ? "future" : "past"]; return "function" == typeof c ? c(b) : c.replace(/%s/i, b) }, ordinal: function (a) { return this._ordinal.replace("%d", a) }, _ordinal: "%d", _ordinalParse: /\d{1,2}/, preparse: function (a) { return a }, postformat: function (a) { return a }, week: function (a) { return jb(a, this._week.dow, this._week.doy).week }, _week: { dow: 0, doy: 6 }, firstDayOfWeek: function () { return this._week.dow }, firstDayOfYear: function () { return this._week.doy }, _invalidDate: "Invalid date", invalidDate: function () { return this._invalidDate } }), vb = function (b, c, e, f) { var g; return "boolean" == typeof e && (f = e, e = a), g = {}, g._isAMomentObject = !0, g._i = b, g._f = c, g._l = e, g._strict = f, g._isUTC = !1, g._pf = d(), lb(g) }, vb.suppressDeprecationWarnings = !1, vb.createFromInputFallback = f("moment construction falls back to js Date. This is discouraged and will be removed in upcoming major release. Please refer to https://github.com/moment/moment/issues/1407 for more info.", function (a) { a._d = new Date(a._i + (a._useUTC ? " UTC" : "")) }), vb.min = function () { var a = [].slice.call(arguments, 0); return mb("isBefore", a) }, vb.max = function () { var a = [].slice.call(arguments, 0); return mb("isAfter", a) }, vb.utc = function (b, c, e, f) { var g; return "boolean" == typeof e && (f = e, e = a), g = {}, g._isAMomentObject = !0, g._useUTC = !0, g._isUTC = !0, g._l = e, g._i = b, g._f = c, g._strict = f, g._pf = d(), lb(g).utc() }, vb.unix = function (a) { return vb(1e3 * a) }, vb.duration = function (a, b) { var d, e, f, g, h = a, i = null; return vb.isDuration(a) ? h = { ms: a._milliseconds, d: a._days, M: a._months } : "number" == typeof a ? (h = {}, b ? h[b] = a : h.milliseconds = a) : (i = Nb.exec(a)) ? (d = "-" === i[1] ? -1 : 1, h = { y: 0, d: C(i[Eb]) * d, h: C(i[Fb]) * d, m: C(i[Gb]) * d, s: C(i[Hb]) * d, ms: C(i[Ib]) * d }) : (i = Ob.exec(a)) ? (d = "-" === i[1] ? -1 : 1, f = function (a) { var b = a && parseFloat(a.replace(",", ".")); return (isNaN(b) ? 0 : b) * d }, h = { y: f(i[2]), M: f(i[3]), d: f(i[4]), h: f(i[5]), m: f(i[6]), s: f(i[7]), w: f(i[8]) }) : null == h ? h = {} : "object" == typeof h && ("from" in h || "to" in h) && (g = t(vb(h.from), vb(h.to)), h = {}, h.ms = g.milliseconds, h.M = g.months), e = new n(h), vb.isDuration(a) && c(a, "_locale") && (e._locale = a._locale), e }, vb.version = yb, vb.defaultFormat = gc, vb.ISO_8601 = function () { }, vb.momentProperties = Kb, vb.updateOffset = function () { }, vb.relativeTimeThreshold = function (b, c) { return oc[b] === a ? !1 : c === a ? oc[b] : (oc[b] = c, !0) }, vb.lang = f("moment.lang is deprecated. Use moment.locale instead.", function (a, b) { return vb.locale(a, b) }), vb.locale = function (a, b) { var c; return a && (c = "undefined" != typeof b ? vb.defineLocale(a, b) : vb.localeData(a), c && (vb.duration._locale = vb._locale = c)), vb._locale._abbr }, vb.defineLocale = function (a, b) { return null !== b ? (b.abbr = a, Jb[a] || (Jb[a] = new l), Jb[a].set(b), vb.locale(a), Jb[a]) : (delete Jb[a], null) }, vb.langData = f("moment.langData is deprecated. Use moment.localeData instead.", function (a) { return vb.localeData(a) }), vb.localeData = function (a) { var b; if (a && a._locale && a._locale._abbr && (a = a._locale._abbr), !a) return vb._locale; if (!w(a)) { if (b = L(a)) return b; a = [a] } return K(a) }, vb.isMoment = function (a) { return a instanceof m || null != a && c(a, "_isAMomentObject") }, vb.isDuration = function (a) { return a instanceof n }; for (xb = tc.length - 1; xb >= 0; --xb) B(tc[xb]); vb.normalizeUnits = function (a) { return z(a) }, vb.invalid = function (a) { var b = vb.utc(0 / 0); return null != a ? o(b._pf, a) : b._pf.userInvalidated = !0, b }, vb.parseZone = function () { return vb.apply(null, arguments).parseZone() }, vb.parseTwoDigitYear = function (a) { return C(a) + (C(a) > 68 ? 1900 : 2e3) }, vb.isDate = x, o(vb.fn = m.prototype, { clone: function () { return vb(this) }, valueOf: function () { return +this._d - 6e4 * (this._offset || 0) }, unix: function () { return Math.floor(+this / 1e3) }, toString: function () { return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ") }, toDate: function () { return this._offset ? new Date(+this) : this._d }, toISOString: function () { var a = vb(this).utc(); return 0 < a.year() && a.year() <= 9999 ? "function" == typeof Date.prototype.toISOString ? this.toDate().toISOString() : P(a, "YYYY-MM-DD[T]HH:mm:ss.SSS[Z]") : P(a, "YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]") }, toArray: function () { var a = this; return [a.year(), a.month(), a.date(), a.hours(), a.minutes(), a.seconds(), a.milliseconds()] }, isValid: function () { return I(this) }, isDSTShifted: function () { return this._a ? this.isValid() && y(this._a, (this._isUTC ? vb.utc(this._a) : vb(this._a)).toArray()) > 0 : !1 }, parsingFlags: function () { return o({}, this._pf) }, invalidAt: function () { return this._pf.overflow }, utc: function (a) { return this.utcOffset(0, a) }, local: function (a) { return this._isUTC && (this.utcOffset(0, a), this._isUTC = !1, a && this.subtract(this._dateUtcOffset(), "m")), this }, format: function (a) { var b = P(this, a || vb.defaultFormat); return this.localeData().postformat(b) }, add: u(1, "add"), subtract: u(-1, "subtract"), diff: function (a, b, c) { var d, e, f = M(a, this), g = 6e4 * (f.utcOffset() - this.utcOffset()); return b = z(b), "year" === b || "month" === b || "quarter" === b ? (e = j(this, f), "quarter" === b ? e /= 3 : "year" === b && (e /= 12)) : (d = this - f, e = "second" === b ? d / 1e3 : "minute" === b ? d / 6e4 : "hour" === b ? d / 36e5 : "day" === b ? (d - g) / 864e5 : "week" === b ? (d - g) / 6048e5 : d), c ? e : q(e) }, from: function (a, b) { return vb.duration({ to: this, from: a }).locale(this.locale()).humanize(!b) }, fromNow: function (a) { return this.from(vb(), a) }, calendar: function (a) { var b = a || vb(), c = M(b, this).startOf("day"), d = this.diff(c, "days", !0), e = -6 > d ? "sameElse" : -1 > d ? "lastWeek" : 0 > d ? "lastDay" : 1 > d ? "sameDay" : 2 > d ? "nextDay" : 7 > d ? "nextWeek" : "sameElse"; return this.format(this.localeData().calendar(e, this, vb(b))) }, isLeapYear: function () { return G(this.year()) }, isDST: function () { return this.utcOffset() > this.clone().month(0).utcOffset() || this.utcOffset() > this.clone().month(5).utcOffset() }, day: function (a) { var b = this._isUTC ? this._d.getUTCDay() : this._d.getDay(); return null != a ? (a = gb(a, this.localeData()), this.add(a - b, "d")) : b }, month: qb("Month", !0), startOf: function (a) { switch (a = z(a)) { case "year": this.month(0); case "quarter": case "month": this.date(1); case "week": case "isoWeek": case "day": this.hours(0); case "hour": this.minutes(0); case "minute": this.seconds(0); case "second": this.milliseconds(0) } return "week" === a ? this.weekday(0) : "isoWeek" === a && this.isoWeekday(1), "quarter" === a && this.month(3 * Math.floor(this.month() / 3)), this }, endOf: function (b) { return b = z(b), b === a || "millisecond" === b ? this : this.startOf(b).add(1, "isoWeek" === b ? "week" : b).subtract(1, "ms") }, isAfter: function (a, b) { var c; return b = z("undefined" != typeof b ? b : "millisecond"), "millisecond" === b ? (a = vb.isMoment(a) ? a : vb(a), +this > +a) : (c = vb.isMoment(a) ? +a : +vb(a), c < +this.clone().startOf(b)) }, isBefore: function (a, b) { var c; return b = z("undefined" != typeof b ? b : "millisecond"), "millisecond" === b ? (a = vb.isMoment(a) ? a : vb(a), +a > +this) : (c = vb.isMoment(a) ? +a : +vb(a), +this.clone().endOf(b) < c) }, isBetween: function (a, b, c) { return this.isAfter(a, c) && this.isBefore(b, c) }, isSame: function (a, b) { var c; return b = z(b || "millisecond"), "millisecond" === b ? (a = vb.isMoment(a) ? a : vb(a), +this === +a) : (c = +vb(a), +this.clone().startOf(b) <= c && c <= +this.clone().endOf(b)) }, min: f("moment().min is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548", function (a) { return a = vb.apply(null, arguments), this > a ? this : a }), max: f("moment().max is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548", function (a) { return a = vb.apply(null, arguments), a > this ? this : a }), zone: f("moment().zone is deprecated, use moment().utcOffset instead. https://github.com/moment/moment/issues/1779", function (a, b) { return null != a ? ("string" != typeof a && (a = -a), this.utcOffset(a, b), this) : -this.utcOffset() }), utcOffset: function (a, b) { var c, d = this._offset || 0; return null != a ? ("string" == typeof a && (a = S(a)), Math.abs(a) < 16 && (a = 60 * a), !this._isUTC && b && (c = this._dateUtcOffset()), this._offset = a, this._isUTC = !0, null != c && this.add(c, "m"), d !== a && (!b || this._changeInProgress ? v(this, vb.duration(a - d, "m"), 1, !1) : this._changeInProgress || (this._changeInProgress = !0, vb.updateOffset(this, !0), this._changeInProgress = null)), this) : this._isUTC ? d : this._dateUtcOffset() }, isLocal: function () { return !this._isUTC }, isUtcOffset: function () { return this._isUTC }, isUtc: function () { return this._isUTC && 0 === this._offset }, zoneAbbr: function () { return this._isUTC ? "UTC" : "" }, zoneName: function () { return this._isUTC ? "Coordinated Universal Time" : "" }, parseZone: function () { return this._tzm ? this.utcOffset(this._tzm) : "string" == typeof this._i && this.utcOffset(S(this._i)), this }, hasAlignedHourOffset: function (a) { return a = a ? vb(a).utcOffset() : 0, (this.utcOffset() - a) % 60 === 0 }, daysInMonth: function () { return D(this.year(), this.month()) }, dayOfYear: function (a) { var b = Ab((vb(this).startOf("day") - vb(this).startOf("year")) / 864e5) + 1; return null == a ? b : this.add(a - b, "d") }, quarter: function (a) { return null == a ? Math.ceil((this.month() + 1) / 3) : this.month(3 * (a - 1) + this.month() % 3) }, weekYear: function (a) { var b = jb(this, this.localeData()._week.dow, this.localeData()._week.doy).year; return null == a ? b : this.add(a - b, "y") }, isoWeekYear: function (a) { var b = jb(this, 1, 4).year; return null == a ? b : this.add(a - b, "y") }, week: function (a) { var b = this.localeData().week(this); return null == a ? b : this.add(7 * (a - b), "d") }, isoWeek: function (a) { var b = jb(this, 1, 4).week; return null == a ? b : this.add(7 * (a - b), "d") }, weekday: function (a) { var b = (this.day() + 7 - this.localeData()._week.dow) % 7; return null == a ? b : this.add(a - b, "d") }, isoWeekday: function (a) { return null == a ? this.day() || 7 : this.day(this.day() % 7 ? a : a - 7) }, isoWeeksInYear: function () { return E(this.year(), 1, 4) }, weeksInYear: function () { var a = this.localeData()._week; return E(this.year(), a.dow, a.doy) }, get: function (a) { return a = z(a), this[a]() }, set: function (a, b) { var c; if ("object" == typeof a) for (c in a) this.set(c, a[c]); else a = z(a), "function" == typeof this[a] && this[a](b); return this }, locale: function (b) { var c; return b === a ? this._locale._abbr : (c = vb.localeData(b), null != c && (this._locale = c), this) }, lang: f("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.", function (b) { return b === a ? this.localeData() : this.locale(b) }), localeData: function () { return this._locale }, _dateUtcOffset: function () { return 15 * -Math.round(this._d.getTimezoneOffset() / 15) } }), vb.fn.millisecond = vb.fn.milliseconds = qb("Milliseconds", !1), vb.fn.second = vb.fn.seconds = qb("Seconds", !1), vb.fn.minute = vb.fn.minutes = qb("Minutes", !1), vb.fn.hour = vb.fn.hours = qb("Hours", !0), vb.fn.date = qb("Date", !0), vb.fn.dates = f("dates accessor is deprecated. Use date instead.", qb("Date", !0)), vb.fn.year = qb("FullYear", !0), vb.fn.years = f("years accessor is deprecated. Use year instead.", qb("FullYear", !0)), vb.fn.days = vb.fn.day, vb.fn.months = vb.fn.month, vb.fn.weeks = vb.fn.week, vb.fn.isoWeeks = vb.fn.isoWeek, vb.fn.quarters = vb.fn.quarter, vb.fn.toJSON = vb.fn.toISOString, vb.fn.isUTC = vb.fn.isUtc, o(vb.duration.fn = n.prototype, {
        _bubble: function () { var a, b, c, d = this._milliseconds, e = this._days, f = this._months, g = this._data, h = 0; g.milliseconds = d % 1e3, a = q(d / 1e3), g.seconds = a % 60, b = q(a / 60), g.minutes = b % 60, c = q(b / 60), g.hours = c % 24, e += q(c / 24), h = q(rb(e)), e -= q(sb(h)), f += q(e / 30), e %= 30, h += q(f / 12), f %= 12, g.days = e, g.months = f, g.years = h }, abs: function () { return this._milliseconds = Math.abs(this._milliseconds), this._days = Math.abs(this._days), this._months = Math.abs(this._months), this._data.milliseconds = Math.abs(this._data.milliseconds), this._data.seconds = Math.abs(this._data.seconds), this._data.minutes = Math.abs(this._data.minutes), this._data.hours = Math.abs(this._data.hours), this._data.months = Math.abs(this._data.months), this._data.years = Math.abs(this._data.years), this }, weeks: function () { return q(this.days() / 7) }, valueOf: function () {
            return this._milliseconds + 864e5 * this._days + this._months % 12 * 2592e6 + 31536e6 * C(this._months / 12)
        }, humanize: function (a) { var b = ib(this, !a, this.localeData()); return a && (b = this.localeData().pastFuture(+this, b)), this.localeData().postformat(b) }, add: function (a, b) { var c = vb.duration(a, b); return this._milliseconds += c._milliseconds, this._days += c._days, this._months += c._months, this._bubble(), this }, subtract: function (a, b) { var c = vb.duration(a, b); return this._milliseconds -= c._milliseconds, this._days -= c._days, this._months -= c._months, this._bubble(), this }, get: function (a) { return a = z(a), this[a.toLowerCase() + "s"]() }, as: function (a) { var b, c; if (a = z(a), "month" === a || "year" === a) return b = this._days + this._milliseconds / 864e5, c = this._months + 12 * rb(b), "month" === a ? c : c / 12; switch (b = this._days + Math.round(sb(this._months / 12)), a) { case "week": return b / 7 + this._milliseconds / 6048e5; case "day": return b + this._milliseconds / 864e5; case "hour": return 24 * b + this._milliseconds / 36e5; case "minute": return 24 * b * 60 + this._milliseconds / 6e4; case "second": return 24 * b * 60 * 60 + this._milliseconds / 1e3; case "millisecond": return Math.floor(24 * b * 60 * 60 * 1e3) + this._milliseconds; default: throw new Error("Unknown unit " + a) } }, lang: vb.fn.lang, locale: vb.fn.locale, toIsoString: f("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)", function () { return this.toISOString() }), toISOString: function () { var a = Math.abs(this.years()), b = Math.abs(this.months()), c = Math.abs(this.days()), d = Math.abs(this.hours()), e = Math.abs(this.minutes()), f = Math.abs(this.seconds() + this.milliseconds() / 1e3); return this.asSeconds() ? (this.asSeconds() < 0 ? "-" : "") + "P" + (a ? a + "Y" : "") + (b ? b + "M" : "") + (c ? c + "D" : "") + (d || e || f ? "T" : "") + (d ? d + "H" : "") + (e ? e + "M" : "") + (f ? f + "S" : "") : "P0D" }, localeData: function () { return this._locale }, toJSON: function () { return this.toISOString() }
    }), vb.duration.fn.toString = vb.duration.fn.toISOString; for (xb in kc) c(kc, xb) && tb(xb.toLowerCase()); vb.duration.fn.asMilliseconds = function () { return this.as("ms") }, vb.duration.fn.asSeconds = function () { return this.as("s") }, vb.duration.fn.asMinutes = function () { return this.as("m") }, vb.duration.fn.asHours = function () { return this.as("h") }, vb.duration.fn.asDays = function () { return this.as("d") }, vb.duration.fn.asWeeks = function () { return this.as("weeks") }, vb.duration.fn.asMonths = function () { return this.as("M") }, vb.duration.fn.asYears = function () { return this.as("y") }, vb.locale("en", { ordinalParse: /\d{1,2}(th|st|nd|rd)/, ordinal: function (a) { var b = a % 10, c = 1 === C(a % 100 / 10) ? "th" : 1 === b ? "st" : 2 === b ? "nd" : 3 === b ? "rd" : "th"; return a + c } }), Lb ? module.exports = vb : "function" == typeof define && define.amd ? (define(function (a, b, c) { return c.config && c.config() && c.config().noGlobal === !0 && (zb.moment = wb), vb }), ub(!0)) : ub()
}).call(this);;
/* =========================================================
 * bootstrap-datepicker.js
 * Repo: https://github.com/eternicode/bootstrap-datepicker/
 * Demo: http://eternicode.github.io/bootstrap-datepicker/
 * Docs: http://bootstrap-datepicker.readthedocs.org/
 * Forked from http://www.eyecon.ro/bootstrap-datepicker
 * =========================================================
 * Started by Stefan Petre; improvements by Andrew Rowls + contributors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * ========================================================= */

(function ($, undefined) {

    function UTCDate() {
        return new Date(Date.UTC.apply(Date, arguments));
    }
    function UTCToday() {
        var today = new Date();
        return UTCDate(today.getFullYear(), today.getMonth(), today.getDate());
    }
    function isUTCEquals(date1, date2) {
        return (date1.getUTCFullYear() === date2.getUTCFullYear() &&
					date1.getUTCMonth() === date2.getUTCMonth() &&
					date1.getUTCDate() === date2.getUTCDate());
    }
    function alias(method) {
        return function () {
            return this[method].apply(this, arguments);
        };
    }

    var DateArray = (function () {
        var extras = {
            get: function (i) {
                return this.slice(i)[0];
            },
            contains: function (d) {
                // Array.indexOf is not cross-browser;
                // $.inArray doesn't work with Dates
                var val = d && d.valueOf();
                for (var i = 0, l = this.length; i < l; i++)
                    if (this[i].valueOf() === val)
                        return i;
                return -1;
            },
            remove: function (i) {
                this.splice(i, 1);
            },
            replace: function (new_array) {
                if (!new_array)
                    return;
                if (!$.isArray(new_array))
                    new_array = [new_array];
                this.clear();
                this.push.apply(this, new_array);
            },
            clear: function () {
                this.length = 0;
            },
            copy: function () {
                var a = new DateArray();
                a.replace(this);
                return a;
            }
        };

        return function () {
            var a = [];
            a.push.apply(a, arguments);
            $.extend(a, extras);
            return a;
        };
    })();


    // Picker object

    var Datepicker = function (element, options) {
        this._process_options(options);

        this.dates = new DateArray();
        this.viewDate = this.o.defaultViewDate;
        this.focusDate = null;

        this.element = $(element);
        this.isInline = false;
        this.isInput = this.element.is('input');
        this.component = this.element.is('.date') ? this.element.find('.add-on, .input-group-addon, .btn') : false;
        this.hasInput = this.component && this.element.find('input').length;
        if (this.component && this.component.length === 0)
            this.component = false;

        this.picker = $(DPGlobal.template);
        this._buildEvents();
        this._attachEvents();

        if (this.isInline) {
            this.picker.addClass('datepicker-inline').appendTo(this.element);
        }
        else {
            this.picker.addClass('datepicker-dropdown dropdown-menu');
        }

        if (this.o.rtl) {
            this.picker.addClass('datepicker-rtl');
        }

        this.viewMode = this.o.startView;

        if (this.o.calendarWeeks)
            this.picker.find('tfoot th.today, tfoot th.clear')
						.attr('colspan', function (i, val) {
						    return parseInt(val) + 1;
						});

        this._allow_update = false;

        this.setStartDate(this._o.startDate);
        this.setEndDate(this._o.endDate);
        this.setDaysOfWeekDisabled(this.o.daysOfWeekDisabled);
        this.setDatesDisabled(this.o.datesDisabled);

        this.fillDow();
        this.fillMonths();

        this._allow_update = true;

        this.update();
        this.showMode();

        if (this.isInline) {
            this.show();
        }
    };

    Datepicker.prototype = {
        constructor: Datepicker,

        _process_options: function (opts) {
            // Store raw options for reference
            this._o = $.extend({}, this._o, opts);
            // Processed options
            var o = this.o = $.extend({}, this._o);

            // Check if "de-DE" style date is available, if not language should
            // fallback to 2 letter code eg "de"
            var lang = o.language;
            if (!dates[lang]) {
                lang = lang.split('-')[0];
                if (!dates[lang])
                    lang = defaults.language;
            }
            o.language = lang;

            switch (o.startView) {
                case 2:
                case 'decade':
                    o.startView = 2;
                    break;
                case 1:
                case 'year':
                    o.startView = 1;
                    break;
                default:
                    o.startView = 0;
            }

            switch (o.minViewMode) {
                case 1:
                case 'months':
                    o.minViewMode = 1;
                    break;
                case 2:
                case 'years':
                    o.minViewMode = 2;
                    break;
                default:
                    o.minViewMode = 0;
            }

            o.startView = Math.max(o.startView, o.minViewMode);

            // true, false, or Number > 0
            if (o.multidate !== true) {
                o.multidate = Number(o.multidate) || false;
                if (o.multidate !== false)
                    o.multidate = Math.max(0, o.multidate);
            }
            o.multidateSeparator = String(o.multidateSeparator);

            o.weekStart %= 7;
            o.weekEnd = ((o.weekStart + 6) % 7);

            var format = DPGlobal.parseFormat(o.format);
            if (o.startDate !== -Infinity) {
                if (!!o.startDate) {
                    if (o.startDate instanceof Date)
                        o.startDate = this._local_to_utc(this._zero_time(o.startDate));
                    else
                        o.startDate = DPGlobal.parseDate(o.startDate, format, o.language);
                }
                else {
                    o.startDate = -Infinity;
                }
            }
            if (o.endDate !== Infinity) {
                if (!!o.endDate) {
                    if (o.endDate instanceof Date)
                        o.endDate = this._local_to_utc(this._zero_time(o.endDate));
                    else
                        o.endDate = DPGlobal.parseDate(o.endDate, format, o.language);
                }
                else {
                    o.endDate = Infinity;
                }
            }

            o.daysOfWeekDisabled = o.daysOfWeekDisabled || [];
            if (!$.isArray(o.daysOfWeekDisabled))
                o.daysOfWeekDisabled = o.daysOfWeekDisabled.split(/[,\s]*/);
            o.daysOfWeekDisabled = $.map(o.daysOfWeekDisabled, function (d) {
                return parseInt(d, 10);
            });

            o.datesDisabled = o.datesDisabled || [];
            if (!$.isArray(o.datesDisabled)) {
                var datesDisabled = [];
                datesDisabled.push(DPGlobal.parseDate(o.datesDisabled, format, o.language));
                o.datesDisabled = datesDisabled;
            }
            o.datesDisabled = $.map(o.datesDisabled, function (d) {
                return DPGlobal.parseDate(d, format, o.language);
            });

            var plc = String(o.orientation).toLowerCase().split(/\s+/g),
				_plc = o.orientation.toLowerCase();
            plc = $.grep(plc, function (word) {
                return (/^auto|left|right|top|bottom$/).test(word);
            });
            o.orientation = { x: 'auto', y: 'auto' };
            if (!_plc || _plc === 'auto')
                ; // no action
            else if (plc.length === 1) {
                switch (plc[0]) {
                    case 'top':
                    case 'bottom':
                        o.orientation.y = plc[0];
                        break;
                    case 'left':
                    case 'right':
                        o.orientation.x = plc[0];
                        break;
                }
            }
            else {
                _plc = $.grep(plc, function (word) {
                    return (/^left|right$/).test(word);
                });
                o.orientation.x = _plc[0] || 'auto';

                _plc = $.grep(plc, function (word) {
                    return (/^top|bottom$/).test(word);
                });
                o.orientation.y = _plc[0] || 'auto';
            }
            if (o.defaultViewDate) {
                var year = o.defaultViewDate.year || new Date().getFullYear();
                var month = o.defaultViewDate.month || 0;
                var day = o.defaultViewDate.day || 1;
                o.defaultViewDate = UTCDate(year, month, day);
            } else {
                o.defaultViewDate = UTCToday();
            }
            o.showOnFocus = o.showOnFocus !== undefined ? o.showOnFocus : true;
        },
        _events: [],
        _secondaryEvents: [],
        _applyEvents: function (evs) {
            for (var i = 0, el, ch, ev; i < evs.length; i++) {
                el = evs[i][0];
                if (evs[i].length === 2) {
                    ch = undefined;
                    ev = evs[i][1];
                }
                else if (evs[i].length === 3) {
                    ch = evs[i][1];
                    ev = evs[i][2];
                }
                el.on(ev, ch);
            }
        },
        _unapplyEvents: function (evs) {
            for (var i = 0, el, ev, ch; i < evs.length; i++) {
                el = evs[i][0];
                if (evs[i].length === 2) {
                    ch = undefined;
                    ev = evs[i][1];
                }
                else if (evs[i].length === 3) {
                    ch = evs[i][1];
                    ev = evs[i][2];
                }
                el.off(ev, ch);
            }
        },
        _buildEvents: function () {
            var events = {
                keyup: $.proxy(function (e) {
                    if ($.inArray(e.keyCode, [27, 37, 39, 38, 40, 32, 13, 9]) === -1)
                        this.update();
                }, this),
                keydown: $.proxy(this.keydown, this)
            };

            if (this.o.showOnFocus === true) {
                events.focus = $.proxy(this.show, this);
            }

            if (this.isInput) { // single input
                this._events = [
                    [this.element, events]
                ];
            }
            else if (this.component && this.hasInput) { // component: input + button
                this._events = [
                    // For components that are not readonly, allow keyboard nav
                    [this.element.find('input'), events],
                    [this.component, {
                        click: $.proxy(this.show, this)
                    }]
                ];
            }
            else if (this.element.is('div')) {  // inline datepicker
                this.isInline = true;
            }
            else {
                this._events = [
					[this.element, {
					    click: $.proxy(this.show, this)
					}]
                ];
            }
            this._events.push(
				// Component: listen for blur on element descendants
				[this.element, '*', {
				    blur: $.proxy(function (e) {
				        this._focused_from = e.target;
				    }, this)
				}],
				// Input: listen for blur on element
				[this.element, {
				    blur: $.proxy(function (e) {
				        this._focused_from = e.target;
				    }, this)
				}]
			);

            this._secondaryEvents = [
				[this.picker, {
				    click: $.proxy(this.click, this)
				}],
				[$(window), {
				    resize: $.proxy(this.place, this)
				}],
				[$(document), {
				    'mousedown touchstart': $.proxy(function (e) {
				        // Clicked outside the datepicker, hide it
				        if (!(
							this.element.is(e.target) ||
							this.element.find(e.target).length ||
							this.picker.is(e.target) ||
							this.picker.find(e.target).length
						)) {
				            this.hide();
				        }
				    }, this)
				}]
            ];
        },
        _attachEvents: function () {
            this._detachEvents();
            this._applyEvents(this._events);
        },
        _detachEvents: function () {
            this._unapplyEvents(this._events);
        },
        _attachSecondaryEvents: function () {
            this._detachSecondaryEvents();
            this._applyEvents(this._secondaryEvents);
        },
        _detachSecondaryEvents: function () {
            this._unapplyEvents(this._secondaryEvents);
        },
        _trigger: function (event, altdate) {
            var date = altdate || this.dates.get(-1),
				local_date = this._utc_to_local(date);

            this.element.trigger({
                type: event,
                date: local_date,
                dates: $.map(this.dates, this._utc_to_local),
                format: $.proxy(function (ix, format) {
                    if (arguments.length === 0) {
                        ix = this.dates.length - 1;
                        format = this.o.format;
                    }
                    else if (typeof ix === 'string') {
                        format = ix;
                        ix = this.dates.length - 1;
                    }
                    format = format || this.o.format;
                    var date = this.dates.get(ix);
                    return DPGlobal.formatDate(date, format, this.o.language);
                }, this)
            });
        },

        show: function () {
            if (this.element.attr('readonly'))
                return;
            if (!this.isInline)
                this.picker.appendTo(this.o.container);
            this.place();
            this.picker.show();
            this._attachSecondaryEvents();
            this._trigger('show');
            if ((window.navigator.msMaxTouchPoints || 'ontouchstart' in document) && this.o.disableTouchKeyboard) {
                $(this.element).blur();
            }
            return this;
        },

        hide: function () {
            if (this.isInline)
                return this;
            if (!this.picker.is(':visible'))
                return this;
            this.focusDate = null;
            this.picker.hide().detach();
            this._detachSecondaryEvents();
            this.viewMode = this.o.startView;
            this.showMode();

            if (
				this.o.forceParse &&
				(
					this.isInput && this.element.val() ||
					this.hasInput && this.element.find('input').val()
				)
			)
                this.setValue();
            this._trigger('hide');
            return this;
        },

        remove: function () {
            this.hide();
            this._detachEvents();
            this._detachSecondaryEvents();
            this.picker.remove();
            delete this.element.data().datepicker;
            if (!this.isInput) {
                delete this.element.data().date;
            }
            return this;
        },

        _utc_to_local: function (utc) {
            return utc && new Date(utc.getTime() + (utc.getTimezoneOffset() * 60000));
        },
        _local_to_utc: function (local) {
            return local && new Date(local.getTime() - (local.getTimezoneOffset() * 60000));
        },
        _zero_time: function (local) {
            return local && new Date(local.getFullYear(), local.getMonth(), local.getDate());
        },
        _zero_utc_time: function (utc) {
            return utc && new Date(Date.UTC(utc.getUTCFullYear(), utc.getUTCMonth(), utc.getUTCDate()));
        },

        getDates: function () {
            return $.map(this.dates, this._utc_to_local);
        },

        getUTCDates: function () {
            return $.map(this.dates, function (d) {
                return new Date(d);
            });
        },

        getDate: function () {
            return this._utc_to_local(this.getUTCDate());
        },

        getUTCDate: function () {
            var selected_date = this.dates.get(-1);
            if (typeof selected_date !== 'undefined') {
                return new Date(selected_date);
            } else {
                return null;
            }
        },

        clearDates: function () {
            var element;
            if (this.isInput) {
                element = this.element;
            } else if (this.component) {
                element = this.element.find('input');
            }

            if (element) {
                element.val('').change();
            }

            this.update();
            this._trigger('changeDate');

            if (this.o.autoclose) {
                this.hide();
            }
        },
        setDates: function () {
            var args = $.isArray(arguments[0]) ? arguments[0] : arguments;
            this.update.apply(this, args);
            this._trigger('changeDate');
            this.setValue();
            return this;
        },

        setUTCDates: function () {
            var args = $.isArray(arguments[0]) ? arguments[0] : arguments;
            this.update.apply(this, $.map(args, this._utc_to_local));
            this._trigger('changeDate');
            this.setValue();
            return this;
        },

        setDate: alias('setDates'),
        setUTCDate: alias('setUTCDates'),

        setValue: function () {
            var formatted = this.getFormattedDate();
            if (!this.isInput) {
                if (this.component) {
                    this.element.find('input').val(formatted).change();
                }
            }
            else {
                this.element.val(formatted).change();
            }
            return this;
        },

        getFormattedDate: function (format) {
            if (format === undefined)
                format = this.o.format;

            var lang = this.o.language;
            return $.map(this.dates, function (d) {
                return DPGlobal.formatDate(d, format, lang);
            }).join(this.o.multidateSeparator);
        },

        setStartDate: function (startDate) {
            this._process_options({ startDate: startDate });
            this.update();
            this.updateNavArrows();
            return this;
        },

        setEndDate: function (endDate) {
            this._process_options({ endDate: endDate });
            this.update();
            this.updateNavArrows();
            return this;
        },

        setDaysOfWeekDisabled: function (daysOfWeekDisabled) {
            this._process_options({ daysOfWeekDisabled: daysOfWeekDisabled });
            this.update();
            this.updateNavArrows();
            return this;
        },

        setDatesDisabled: function (datesDisabled) {
            this._process_options({ datesDisabled: datesDisabled });
            this.update();
            this.updateNavArrows();
        },

        place: function () {
            if (this.isInline)
                return this;
            var calendarWidth = this.picker.outerWidth(),
				calendarHeight = this.picker.outerHeight(),
				visualPadding = 10,
				windowWidth = $(this.o.container).width(),
				windowHeight = $(this.o.container).height(),
				scrollTop = $(this.o.container).scrollTop(),
				appendOffset = $(this.o.container).offset();

            var parentsZindex = [];
            this.element.parents().each(function () {
                var itemZIndex = $(this).css('z-index');
                if (itemZIndex !== 'auto' && itemZIndex !== 0) parentsZindex.push(parseInt(itemZIndex));
            });
            var zIndex = Math.max.apply(Math, parentsZindex) + 10;
            var offset = this.component ? this.component.parent().offset() : this.element.offset();
            var height = this.component ? this.component.outerHeight(true) : this.element.outerHeight(false);
            var width = this.component ? this.component.outerWidth(true) : this.element.outerWidth(false);
            var left = offset.left - appendOffset.left,
				top = offset.top - appendOffset.top;

            this.picker.removeClass(
				'datepicker-orient-top datepicker-orient-bottom ' +
				'datepicker-orient-right datepicker-orient-left'
			);

            if (this.o.orientation.x !== 'auto') {
                this.picker.addClass('datepicker-orient-' + this.o.orientation.x);
                if (this.o.orientation.x === 'right')
                    left -= calendarWidth - width;
            }
                // auto x orientation is best-placement: if it crosses a window
                // edge, fudge it sideways
            else {
                if (offset.left < 0) {
                    // component is outside the window on the left side. Move it into visible range
                    this.picker.addClass('datepicker-orient-left');
                    left -= offset.left - visualPadding;
                } else if (left + calendarWidth > windowWidth) {
                    // the calendar passes the widow right edge. Align it to component right side
                    this.picker.addClass('datepicker-orient-right');
                    left = offset.left + width - calendarWidth;
                } else {
                    // Default to left
                    this.picker.addClass('datepicker-orient-left');
                }
            }

            // auto y orientation is best-situation: top or bottom, no fudging,
            // decision based on which shows more of the calendar
            var yorient = this.o.orientation.y,
				top_overflow, bottom_overflow;
            if (yorient === 'auto') {
                top_overflow = -scrollTop + top - calendarHeight;
                bottom_overflow = scrollTop + windowHeight - (top + height + calendarHeight);
                if (Math.max(top_overflow, bottom_overflow) === bottom_overflow)
                    yorient = 'top';
                else
                    yorient = 'bottom';
            }
            this.picker.addClass('datepicker-orient-' + yorient);
            if (yorient === 'top')
                top += height;
            else
                top -= calendarHeight + parseInt(this.picker.css('padding-top'));

            if (this.o.rtl) {
                var right = windowWidth - (left + width);
                this.picker.css({
                    top: top,
                    right: right,
                    zIndex: zIndex
                });
            } else {
                this.picker.css({
                    top: top,
                    left: left,
                    zIndex: zIndex
                });
            }
            return this;
        },

        _allow_update: true,
        update: function () {
            if (!this._allow_update)
                return this;

            var oldDates = this.dates.copy(),
				dates = [],
				fromArgs = false;
            if (arguments.length) {
                $.each(arguments, $.proxy(function (i, date) {
                    if (date instanceof Date)
                        date = this._local_to_utc(date);
                    dates.push(date);
                }, this));
                fromArgs = true;
            }
            else {
                dates = this.isInput
						? this.element.val()
						: this.element.data('date') || this.element.find('input').val();
                if (dates && this.o.multidate)
                    dates = dates.split(this.o.multidateSeparator);
                else
                    dates = [dates];
                delete this.element.data().date;
            }

            dates = $.map(dates, $.proxy(function (date) {
                return DPGlobal.parseDate(date, this.o.format, this.o.language);
            }, this));
            dates = $.grep(dates, $.proxy(function (date) {
                return (
					date < this.o.startDate ||
					date > this.o.endDate ||
					!date
				);
            }, this), true);
            this.dates.replace(dates);

            if (this.dates.length)
                this.viewDate = new Date(this.dates.get(-1));
            else if (this.viewDate < this.o.startDate)
                this.viewDate = new Date(this.o.startDate);
            else if (this.viewDate > this.o.endDate)
                this.viewDate = new Date(this.o.endDate);

            if (fromArgs) {
                // setting date by clicking
                this.setValue();
            }
            else if (dates.length) {
                // setting date by typing
                if (String(oldDates) !== String(this.dates))
                    this._trigger('changeDate');
            }
            if (!this.dates.length && oldDates.length)
                this._trigger('clearDate');

            this.fill();
            return this;
        },

        fillDow: function () {
            var dowCnt = this.o.weekStart,
				html = '<tr>';
            if (this.o.calendarWeeks) {
                this.picker.find('.datepicker-days thead tr:first-child th.datepicker-switch')
					.attr('colspan', function (i, val) {
					    return parseInt(val) + 1;
					});
                var cell = '<th class="cw">&#160;</th>';
                html += cell;
            }
            while (dowCnt < this.o.weekStart + 7) {
                html += '<th class="dow">' + dates[this.o.language].daysMin[(dowCnt++) % 7] + '</th>';
            }
            html += '</tr>';
            this.picker.find('.datepicker-days thead').append(html);
        },

        fillMonths: function () {
            var html = '',
			i = 0;
            while (i < 12) {
                html += '<span class="month">' + dates[this.o.language].monthsShort[i++] + '</span>';
            }
            this.picker.find('.datepicker-months td').html(html);
        },

        setRange: function (range) {
            if (!range || !range.length)
                delete this.range;
            else
                this.range = $.map(range, function (d) {
                    return d.valueOf();
                });
            this.fill();
        },

        getClassNames: function (date) {
            var cls = [],
				year = this.viewDate.getUTCFullYear(),
				month = this.viewDate.getUTCMonth(),
				today = new Date();
            if (date.getUTCFullYear() < year || (date.getUTCFullYear() === year && date.getUTCMonth() < month)) {
                cls.push('old');
            }
            else if (date.getUTCFullYear() > year || (date.getUTCFullYear() === year && date.getUTCMonth() > month)) {
                cls.push('new');
            }
            if (this.focusDate && date.valueOf() === this.focusDate.valueOf())
                cls.push('focused');
            // Compare internal UTC date with local today, not UTC today
            if (this.o.todayHighlight &&
				date.getUTCFullYear() === today.getFullYear() &&
				date.getUTCMonth() === today.getMonth() &&
				date.getUTCDate() === today.getDate()) {
                cls.push('today');
            }
            if (this.dates.contains(date) !== -1)
                cls.push('active');
            if (date.valueOf() < this.o.startDate || date.valueOf() > this.o.endDate ||
				$.inArray(date.getUTCDay(), this.o.daysOfWeekDisabled) !== -1) {
                cls.push('disabled');
            }
            if (this.o.datesDisabled.length > 0 &&
				$.grep(this.o.datesDisabled, function (d) { return isUTCEquals(date, d); }).length > 0) {
                cls.push('disabled', 'disabled-date');
            }

            if (this.range) {
                if (date > this.range[0] && date < this.range[this.range.length - 1]) {
                    cls.push('range');
                }
                if ($.inArray(date.valueOf(), this.range) !== -1) {
                    cls.push('selected');
                }
            }
            return cls;
        },

        fill: function () {
            var d = new Date(this.viewDate),
				year = d.getUTCFullYear(),
				month = d.getUTCMonth(),
				startYear = this.o.startDate !== -Infinity ? this.o.startDate.getUTCFullYear() : -Infinity,
				startMonth = this.o.startDate !== -Infinity ? this.o.startDate.getUTCMonth() : -Infinity,
				endYear = this.o.endDate !== Infinity ? this.o.endDate.getUTCFullYear() : Infinity,
				endMonth = this.o.endDate !== Infinity ? this.o.endDate.getUTCMonth() : Infinity,
				todaytxt = dates[this.o.language].today || dates['en'].today || '',
				cleartxt = dates[this.o.language].clear || dates['en'].clear || '',
				tooltip;
            if (isNaN(year) || isNaN(month)) return;
            this.picker.find('.datepicker-days thead th.datepicker-switch')
						.text(dates[this.o.language].months[month] + ' ' + year);
            this.picker.find('tfoot th.today')
						.text(todaytxt)
						.toggle(this.o.todayBtn !== false);
            this.picker.find('tfoot th.clear')
						.text(cleartxt)
						.toggle(this.o.clearBtn !== false);
            this.updateNavArrows();
            this.fillMonths();
            var prevMonth = UTCDate(year, month - 1, 28),
				day = DPGlobal.getDaysInMonth(prevMonth.getUTCFullYear(), prevMonth.getUTCMonth());
            prevMonth.setUTCDate(day);
            prevMonth.setUTCDate(day - (prevMonth.getUTCDay() - this.o.weekStart + 7) % 7);
            var nextMonth = new Date(prevMonth);
            nextMonth.setUTCDate(nextMonth.getUTCDate() + 42);
            nextMonth = nextMonth.valueOf();
            var html = [];
            var clsName;
            while (prevMonth.valueOf() < nextMonth) {
                if (prevMonth.getUTCDay() === this.o.weekStart) {
                    html.push('<tr>');
                    if (this.o.calendarWeeks) {
                        // ISO 8601: First week contains first thursday.
                        // ISO also states week starts on Monday, but we can be more abstract here.
                        var
							// Start of current week: based on weekstart/current date
							ws = new Date(+prevMonth + (this.o.weekStart - prevMonth.getUTCDay() - 7) % 7 * 864e5),
							// Thursday of this week
							th = new Date(Number(ws) + (7 + 4 - ws.getUTCDay()) % 7 * 864e5),
							// First Thursday of year, year from thursday
							yth = new Date(Number(yth = UTCDate(th.getUTCFullYear(), 0, 1)) + (7 + 4 - yth.getUTCDay()) % 7 * 864e5),
							// Calendar week: ms between thursdays, div ms per day, div 7 days
							calWeek = (th - yth) / 864e5 / 7 + 1;
                        html.push('<td class="cw">' + calWeek + '</td>');

                    }
                }
                clsName = this.getClassNames(prevMonth);
                clsName.push('day');

                if (this.o.beforeShowDay !== $.noop) {
                    var before = this.o.beforeShowDay(this._utc_to_local(prevMonth));
                    if (before === undefined)
                        before = {};
                    else if (typeof (before) === 'boolean')
                        before = { enabled: before };
                    else if (typeof (before) === 'string')
                        before = { classes: before };
                    if (before.enabled === false)
                        clsName.push('disabled');
                    if (before.classes)
                        clsName = clsName.concat(before.classes.split(/\s+/));
                    if (before.tooltip)
                        tooltip = before.tooltip;
                }

                clsName = $.unique(clsName);
                html.push('<td class="' + clsName.join(' ') + '"' + (tooltip ? ' title="' + tooltip + '"' : '') + '>' + prevMonth.getUTCDate() + '</td>');
                tooltip = null;
                if (prevMonth.getUTCDay() === this.o.weekEnd) {
                    html.push('</tr>');
                }
                prevMonth.setUTCDate(prevMonth.getUTCDate() + 1);
            }
            this.picker.find('.datepicker-days tbody').empty().append(html.join(''));

            var months = this.picker.find('.datepicker-months')
						.find('th:eq(1)')
							.text(year)
							.end()
						.find('span').removeClass('active');

            $.each(this.dates, function (i, d) {
                if (d.getUTCFullYear() === year)
                    months.eq(d.getUTCMonth()).addClass('active');
            });

            if (year < startYear || year > endYear) {
                months.addClass('disabled');
            }
            if (year === startYear) {
                months.slice(0, startMonth).addClass('disabled');
            }
            if (year === endYear) {
                months.slice(endMonth + 1).addClass('disabled');
            }

            if (this.o.beforeShowMonth !== $.noop) {
                var that = this;
                $.each(months, function (i, month) {
                    if (!$(month).hasClass("disabled")) {
                        var moDate = new Date(year, i, 1);
                        var before = that.o.beforeShowMonth(moDate);
                        if (before === false)
                            $(month).addClass('disabled');
                    }
                });
            }

            html = '';
            year = parseInt(year / 10, 10) * 10;
            var yearCont = this.picker.find('.datepicker-years')
								.find('th:eq(1)')
									.text(year + '-' + (year + 9))
									.end()
								.find('td');
            year -= 1;
            var years = $.map(this.dates, function (d) {
                return d.getUTCFullYear();
            }),
				classes;
            for (var i = -1; i < 11; i++) {
                classes = ['year'];
                if (i === -1)
                    classes.push('old');
                else if (i === 10)
                    classes.push('new');
                if ($.inArray(year, years) !== -1)
                    classes.push('active');
                if (year < startYear || year > endYear)
                    classes.push('disabled');
                html += '<span class="' + classes.join(' ') + '">' + year + '</span>';
                year += 1;
            }
            yearCont.html(html);
        },

        updateNavArrows: function () {
            if (!this._allow_update)
                return;

            var d = new Date(this.viewDate),
				year = d.getUTCFullYear(),
				month = d.getUTCMonth();
            switch (this.viewMode) {
                case 0:
                    if (this.o.startDate !== -Infinity && year <= this.o.startDate.getUTCFullYear() && month <= this.o.startDate.getUTCMonth()) {
                        this.picker.find('.prev').css({ visibility: 'hidden' });
                    }
                    else {
                        this.picker.find('.prev').css({ visibility: 'visible' });
                    }
                    if (this.o.endDate !== Infinity && year >= this.o.endDate.getUTCFullYear() && month >= this.o.endDate.getUTCMonth()) {
                        this.picker.find('.next').css({ visibility: 'hidden' });
                    }
                    else {
                        this.picker.find('.next').css({ visibility: 'visible' });
                    }
                    break;
                case 1:
                case 2:
                    if (this.o.startDate !== -Infinity && year <= this.o.startDate.getUTCFullYear()) {
                        this.picker.find('.prev').css({ visibility: 'hidden' });
                    }
                    else {
                        this.picker.find('.prev').css({ visibility: 'visible' });
                    }
                    if (this.o.endDate !== Infinity && year >= this.o.endDate.getUTCFullYear()) {
                        this.picker.find('.next').css({ visibility: 'hidden' });
                    }
                    else {
                        this.picker.find('.next').css({ visibility: 'visible' });
                    }
                    break;
            }
        },

        click: function (e) {
            e.preventDefault();
            var target = $(e.target).closest('span, td, th'),
				year, month, day;
            if (target.length === 1) {
                switch (target[0].nodeName.toLowerCase()) {
                    case 'th':
                        switch (target[0].className) {
                            case 'datepicker-switch':
                                this.showMode(1);
                                break;
                            case 'prev':
                            case 'next':
                                var dir = DPGlobal.modes[this.viewMode].navStep * (target[0].className === 'prev' ? -1 : 1);
                                switch (this.viewMode) {
                                    case 0:
                                        this.viewDate = this.moveMonth(this.viewDate, dir);
                                        this._trigger('changeMonth', this.viewDate);
                                        break;
                                    case 1:
                                    case 2:
                                        this.viewDate = this.moveYear(this.viewDate, dir);
                                        if (this.viewMode === 1)
                                            this._trigger('changeYear', this.viewDate);
                                        break;
                                }
                                this.fill();
                                break;
                            case 'today':
                                var date = new Date();
                                date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0);

                                this.showMode(-2);
                                var which = this.o.todayBtn === 'linked' ? null : 'view';
                                this._setDate(date, which);
                                break;
                            case 'clear':
                                this.clearDates();
                                break;
                        }
                        break;
                    case 'span':
                        if (!target.is('.disabled')) {
                            this.viewDate.setUTCDate(1);
                            if (target.is('.month')) {
                                day = 1;
                                month = target.parent().find('span').index(target);
                                year = this.viewDate.getUTCFullYear();
                                this.viewDate.setUTCMonth(month);
                                this._trigger('changeMonth', this.viewDate);
                                if (this.o.minViewMode === 1) {
                                    this._setDate(UTCDate(year, month, day));
                                }
                            }
                            else {
                                day = 1;
                                month = 0;
                                year = parseInt(target.text(), 10) || 0;
                                this.viewDate.setUTCFullYear(year);
                                this._trigger('changeYear', this.viewDate);
                                if (this.o.minViewMode === 2) {
                                    this._setDate(UTCDate(year, month, day));
                                }
                            }
                            this.showMode(-1);
                            this.fill();
                        }
                        break;
                    case 'td':
                        if (target.is('.day') && !target.is('.disabled')) {
                            day = parseInt(target.text(), 10) || 1;
                            year = this.viewDate.getUTCFullYear();
                            month = this.viewDate.getUTCMonth();
                            if (target.is('.old')) {
                                if (month === 0) {
                                    month = 11;
                                    year -= 1;
                                }
                                else {
                                    month -= 1;
                                }
                            }
                            else if (target.is('.new')) {
                                if (month === 11) {
                                    month = 0;
                                    year += 1;
                                }
                                else {
                                    month += 1;
                                }
                            }
                            this._setDate(UTCDate(year, month, day));
                        }
                        break;
                }
            }
            if (this.picker.is(':visible') && this._focused_from) {
                $(this._focused_from).focus();
            }
            delete this._focused_from;
        },

        _toggle_multidate: function (date) {
            var ix = this.dates.contains(date);
            if (!date) {
                this.dates.clear();
            }

            if (ix !== -1) {
                if (this.o.multidate === true || this.o.multidate > 1 || this.o.toggleActive) {
                    this.dates.remove(ix);
                }
            } else if (this.o.multidate === false) {
                this.dates.clear();
                this.dates.push(date);
            }
            else {
                this.dates.push(date);
            }

            if (typeof this.o.multidate === 'number')
                while (this.dates.length > this.o.multidate)
                    this.dates.remove(0);
        },

        _setDate: function (date, which) {
            if (!which || which === 'date')
                this._toggle_multidate(date && new Date(date));
            if (!which || which === 'view')
                this.viewDate = date && new Date(date);

            this.fill();
            this.setValue();
            if (!which || which !== 'view') {
                this._trigger('changeDate');
            }
            var element;
            if (this.isInput) {
                element = this.element;
            }
            else if (this.component) {
                element = this.element.find('input');
            }
            if (element) {
                element.change();
            }
            if (this.o.autoclose && (!which || which === 'date')) {
                this.hide();
            }
        },

        moveMonth: function (date, dir) {
            if (!date)
                return undefined;
            if (!dir)
                return date;
            var new_date = new Date(date.valueOf()),
				day = new_date.getUTCDate(),
				month = new_date.getUTCMonth(),
				mag = Math.abs(dir),
				new_month, test;
            dir = dir > 0 ? 1 : -1;
            if (mag === 1) {
                test = dir === -1
					// If going back one month, make sure month is not current month
					// (eg, Mar 31 -> Feb 31 == Feb 28, not Mar 02)
					? function () {
					    return new_date.getUTCMonth() === month;
					}
					// If going forward one month, make sure month is as expected
					// (eg, Jan 31 -> Feb 31 == Feb 28, not Mar 02)
					: function () {
					    return new_date.getUTCMonth() !== new_month;
					};
                new_month = month + dir;
                new_date.setUTCMonth(new_month);
                // Dec -> Jan (12) or Jan -> Dec (-1) -- limit expected date to 0-11
                if (new_month < 0 || new_month > 11)
                    new_month = (new_month + 12) % 12;
            }
            else {
                // For magnitudes >1, move one month at a time...
                for (var i = 0; i < mag; i++)
                    // ...which might decrease the day (eg, Jan 31 to Feb 28, etc)...
                    new_date = this.moveMonth(new_date, dir);
                // ...then reset the day, keeping it in the new month
                new_month = new_date.getUTCMonth();
                new_date.setUTCDate(day);
                test = function () {
                    return new_month !== new_date.getUTCMonth();
                };
            }
            // Common date-resetting loop -- if date is beyond end of month, make it
            // end of month
            while (test()) {
                new_date.setUTCDate(--day);
                new_date.setUTCMonth(new_month);
            }
            return new_date;
        },

        moveYear: function (date, dir) {
            return this.moveMonth(date, dir * 12);
        },

        dateWithinRange: function (date) {
            return date >= this.o.startDate && date <= this.o.endDate;
        },

        keydown: function (e) {
            if (this.picker.is(':not(:visible)')) {
                if (e.keyCode === 27) // allow escape to hide and re-show picker
                    this.show();
                return;
            }
            var dateChanged = false,
				dir, newDate, newViewDate,
				focusDate = this.focusDate || this.viewDate;
            switch (e.keyCode) {
                case 27: // escape
                    if (this.focusDate) {
                        this.focusDate = null;
                        this.viewDate = this.dates.get(-1) || this.viewDate;
                        this.fill();
                    }
                    else
                        this.hide();
                    e.preventDefault();
                    break;
                case 37: // left
                case 39: // right
                    if (!this.o.keyboardNavigation)
                        break;
                    dir = e.keyCode === 37 ? -1 : 1;
                    if (e.ctrlKey) {
                        newDate = this.moveYear(this.dates.get(-1) || UTCToday(), dir);
                        newViewDate = this.moveYear(focusDate, dir);
                        this._trigger('changeYear', this.viewDate);
                    }
                    else if (e.shiftKey) {
                        newDate = this.moveMonth(this.dates.get(-1) || UTCToday(), dir);
                        newViewDate = this.moveMonth(focusDate, dir);
                        this._trigger('changeMonth', this.viewDate);
                    }
                    else {
                        newDate = new Date(this.dates.get(-1) || UTCToday());
                        newDate.setUTCDate(newDate.getUTCDate() + dir);
                        newViewDate = new Date(focusDate);
                        newViewDate.setUTCDate(focusDate.getUTCDate() + dir);
                    }
                    if (this.dateWithinRange(newViewDate)) {
                        this.focusDate = this.viewDate = newViewDate;
                        this.setValue();
                        this.fill();
                        e.preventDefault();
                    }
                    break;
                case 38: // up
                case 40: // down
                    if (!this.o.keyboardNavigation)
                        break;
                    dir = e.keyCode === 38 ? -1 : 1;
                    if (e.ctrlKey) {
                        newDate = this.moveYear(this.dates.get(-1) || UTCToday(), dir);
                        newViewDate = this.moveYear(focusDate, dir);
                        this._trigger('changeYear', this.viewDate);
                    }
                    else if (e.shiftKey) {
                        newDate = this.moveMonth(this.dates.get(-1) || UTCToday(), dir);
                        newViewDate = this.moveMonth(focusDate, dir);
                        this._trigger('changeMonth', this.viewDate);
                    }
                    else {
                        newDate = new Date(this.dates.get(-1) || UTCToday());
                        newDate.setUTCDate(newDate.getUTCDate() + dir * 7);
                        newViewDate = new Date(focusDate);
                        newViewDate.setUTCDate(focusDate.getUTCDate() + dir * 7);
                    }
                    if (this.dateWithinRange(newViewDate)) {
                        this.focusDate = this.viewDate = newViewDate;
                        this.setValue();
                        this.fill();
                        e.preventDefault();
                    }
                    break;
                case 32: // spacebar
                    // Spacebar is used in manually typing dates in some formats.
                    // As such, its behavior should not be hijacked.
                    break;
                case 13: // enter
                    focusDate = this.focusDate || this.dates.get(-1) || this.viewDate;
                    if (this.o.keyboardNavigation) {
                        this._toggle_multidate(focusDate);
                        dateChanged = true;
                    }
                    this.focusDate = null;
                    this.viewDate = this.dates.get(-1) || this.viewDate;
                    this.setValue();
                    this.fill();
                    if (this.picker.is(':visible')) {
                        e.preventDefault();
                        if (typeof e.stopPropagation === 'function') {
                            e.stopPropagation(); // All modern browsers, IE9+
                        } else {
                            e.cancelBubble = true; // IE6,7,8 ignore "stopPropagation"
                        }
                        if (this.o.autoclose)
                            this.hide();
                    }
                    break;
                case 9: // tab
                    this.focusDate = null;
                    this.viewDate = this.dates.get(-1) || this.viewDate;
                    this.fill();
                    this.hide();
                    break;
            }
            if (dateChanged) {
                if (this.dates.length)
                    this._trigger('changeDate');
                else
                    this._trigger('clearDate');
                var element;
                if (this.isInput) {
                    element = this.element;
                }
                else if (this.component) {
                    element = this.element.find('input');
                }
                if (element) {
                    element.change();
                }
            }
        },

        showMode: function (dir) {
            if (dir) {
                this.viewMode = Math.max(this.o.minViewMode, Math.min(2, this.viewMode + dir));
            }
            this.picker
				.find('>div')
				.hide()
				.filter('.datepicker-' + DPGlobal.modes[this.viewMode].clsName)
					.css('display', 'block');
            this.updateNavArrows();
        }
    };

    var DateRangePicker = function (element, options) {
        this.element = $(element);
        this.inputs = $.map(options.inputs, function (i) {
            return i.jquery ? i[0] : i;
        });
        delete options.inputs;

        datepickerPlugin.call($(this.inputs), options)
			.bind('changeDate', $.proxy(this.dateUpdated, this));

        this.pickers = $.map(this.inputs, function (i) {
            return $(i).data('datepicker');
        });
        this.updateDates();
    };
    DateRangePicker.prototype = {
        updateDates: function () {
            this.dates = $.map(this.pickers, function (i) {
                return i.getUTCDate();
            });
            this.updateRanges();
        },
        updateRanges: function () {
            var range = $.map(this.dates, function (d) {
                return d.valueOf();
            });
            $.each(this.pickers, function (i, p) {
                p.setRange(range);
            });
        },
        dateUpdated: function (e) {
            // `this.updating` is a workaround for preventing infinite recursion
            // between `changeDate` triggering and `setUTCDate` calling.  Until
            // there is a better mechanism.
            if (this.updating)
                return;
            this.updating = true;

            var dp = $(e.target).data('datepicker'),
				new_date = dp.getUTCDate(),
				i = $.inArray(e.target, this.inputs),
				j = i - 1,
				k = i + 1,
				l = this.inputs.length;
            if (i === -1)
                return;

            $.each(this.pickers, function (i, p) {
                if (!p.getUTCDate())
                    p.setUTCDate(new_date);
            });

            if (new_date < this.dates[j]) {
                // Date being moved earlier/left
                while (j >= 0 && new_date < this.dates[j]) {
                    this.pickers[j--].setUTCDate(new_date);
                }
            }
            else if (new_date > this.dates[k]) {
                // Date being moved later/right
                while (k < l && new_date > this.dates[k]) {
                    this.pickers[k++].setUTCDate(new_date);
                }
            }
            this.updateDates();

            delete this.updating;
        },
        remove: function () {
            $.map(this.pickers, function (p) { p.remove(); });
            delete this.element.data().datepicker;
        }
    };

    function opts_from_el(el, prefix) {
        // Derive options from element data-attrs
        var data = $(el).data(),
			out = {}, inkey,
			replace = new RegExp('^' + prefix.toLowerCase() + '([A-Z])');
        prefix = new RegExp('^' + prefix.toLowerCase());
        function re_lower(_, a) {
            return a.toLowerCase();
        }
        for (var key in data)
            if (prefix.test(key)) {
                inkey = key.replace(replace, re_lower);
                out[inkey] = data[key];
            }
        return out;
    }

    function opts_from_locale(lang) {
        // Derive options from locale plugins
        var out = {};
        // Check if "de-DE" style date is available, if not language should
        // fallback to 2 letter code eg "de"
        if (!dates[lang]) {
            lang = lang.split('-')[0];
            if (!dates[lang])
                return;
        }
        var d = dates[lang];
        $.each(locale_opts, function (i, k) {
            if (k in d)
                out[k] = d[k];
        });
        return out;
    }

    var old = $.fn.datepicker;
    var datepickerPlugin = function (option) {
        var args = Array.apply(null, arguments);
        args.shift();
        var internal_return;
        this.each(function () {
            var $this = $(this),
				data = $this.data('datepicker'),
				options = typeof option === 'object' && option;
            if (!data) {
                var elopts = opts_from_el(this, 'date'),
					// Preliminary otions
					xopts = $.extend({}, defaults, elopts, options),
					locopts = opts_from_locale(xopts.language),
					// Options priority: js args, data-attrs, locales, defaults
					opts = $.extend({}, defaults, locopts, elopts, options);
                if ($this.is('.input-daterange') || opts.inputs) {
                    var ropts = {
                        inputs: opts.inputs || $this.find('input').toArray()
                    };
                    $this.data('datepicker', (data = new DateRangePicker(this, $.extend(opts, ropts))));
                }
                else {
                    $this.data('datepicker', (data = new Datepicker(this, opts)));
                }
            }
            if (typeof option === 'string' && typeof data[option] === 'function') {
                internal_return = data[option].apply(data, args);
                if (internal_return !== undefined)
                    return false;
            }
        });
        if (internal_return !== undefined)
            return internal_return;
        else
            return this;
    };
    $.fn.datepicker = datepickerPlugin;

    var defaults = $.fn.datepicker.defaults = {
        autoclose: false,
        beforeShowDay: $.noop,
        beforeShowMonth: $.noop,
        calendarWeeks: false,
        clearBtn: false,
        toggleActive: false,
        daysOfWeekDisabled: [],
        datesDisabled: [],
        endDate: Infinity,
        forceParse: true,
        format: 'mm/dd/yyyy',
        keyboardNavigation: true,
        language: 'en',
        minViewMode: 0,
        multidate: false,
        multidateSeparator: ',',
        orientation: "auto",
        rtl: false,
        startDate: -Infinity,
        startView: 0,
        todayBtn: false,
        todayHighlight: false,
        weekStart: 0,
        disableTouchKeyboard: false,
        container: 'body'
    };
    var locale_opts = $.fn.datepicker.locale_opts = [
		'format',
		'rtl',
		'weekStart'
    ];
    $.fn.datepicker.Constructor = Datepicker;
    var dates = $.fn.datepicker.dates = {
        en: {
            days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"],
            daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
            daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"],
            months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
            monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
            today: "Today",
            clear: "Clear"
        }
    };

    var DPGlobal = {
        modes: [
			{
			    clsName: 'days',
			    navFnc: 'Month',
			    navStep: 1
			},
			{
			    clsName: 'months',
			    navFnc: 'FullYear',
			    navStep: 1
			},
			{
			    clsName: 'years',
			    navFnc: 'FullYear',
			    navStep: 10
			}],
        isLeapYear: function (year) {
            return (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0));
        },
        getDaysInMonth: function (year, month) {
            return [31, (DPGlobal.isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month];
        },
        validParts: /dd?|DD?|mm?|MM?|yy(?:yy)?/g,
        nonpunctuation: /[^ -\/:-@\[\u3400-\u9fff-`{-~\t\n\r]+/g,
        parseFormat: function (format) {
            // IE treats \0 as a string end in inputs (truncating the value),
            // so it's a bad format delimiter, anyway
            var separators = format.replace(this.validParts, '\0').split('\0'),
				parts = format.match(this.validParts);
            if (!separators || !separators.length || !parts || parts.length === 0) {
                throw new Error("Invalid date format.");
            }
            return { separators: separators, parts: parts };
        },
        parseDate: function (date, format, language) {
            if (!date)
                return undefined;
            if (date instanceof Date)
                return date;
            if (typeof format === 'string')
                format = DPGlobal.parseFormat(format);
            var part_re = /([\-+]\d+)([dmwy])/,
				parts = date.match(/([\-+]\d+)([dmwy])/g),
				part, dir, i;
            if (/^[\-+]\d+[dmwy]([\s,]+[\-+]\d+[dmwy])*$/.test(date)) {
                date = new Date();
                for (i = 0; i < parts.length; i++) {
                    part = part_re.exec(parts[i]);
                    dir = parseInt(part[1]);
                    switch (part[2]) {
                        case 'd':
                            date.setUTCDate(date.getUTCDate() + dir);
                            break;
                        case 'm':
                            date = Datepicker.prototype.moveMonth.call(Datepicker.prototype, date, dir);
                            break;
                        case 'w':
                            date.setUTCDate(date.getUTCDate() + dir * 7);
                            break;
                        case 'y':
                            date = Datepicker.prototype.moveYear.call(Datepicker.prototype, date, dir);
                            break;
                    }
                }
                return UTCDate(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), 0, 0, 0);
            }
            parts = date && date.match(this.nonpunctuation) || [];
            date = new Date();
            var parsed = {},
				setters_order = ['yyyy', 'yy', 'M', 'MM', 'm', 'mm', 'd', 'dd'],
				setters_map = {
				    yyyy: function (d, v) {
				        return d.setUTCFullYear(v);
				    },
				    yy: function (d, v) {
				        return d.setUTCFullYear(2000 + v);
				    },
				    m: function (d, v) {
				        if (isNaN(d))
				            return d;
				        v -= 1;
				        while (v < 0) v += 12;
				        v %= 12;
				        d.setUTCMonth(v);
				        while (d.getUTCMonth() !== v)
				            d.setUTCDate(d.getUTCDate() - 1);
				        return d;
				    },
				    d: function (d, v) {
				        return d.setUTCDate(v);
				    }
				},
				val, filtered;
            setters_map['M'] = setters_map['MM'] = setters_map['mm'] = setters_map['m'];
            setters_map['dd'] = setters_map['d'];
            date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0);
            var fparts = format.parts.slice();
            // Remove noop parts
            if (parts.length !== fparts.length) {
                fparts = $(fparts).filter(function (i, p) {
                    return $.inArray(p, setters_order) !== -1;
                }).toArray();
            }
            // Process remainder
            function match_part() {
                var m = this.slice(0, parts[i].length),
					p = parts[i].slice(0, m.length);
                return m.toLowerCase() === p.toLowerCase();
            }
            if (parts.length === fparts.length) {
                var cnt;
                for (i = 0, cnt = fparts.length; i < cnt; i++) {
                    val = parseInt(parts[i], 10);
                    part = fparts[i];
                    if (isNaN(val)) {
                        switch (part) {
                            case 'MM':
                                filtered = $(dates[language].months).filter(match_part);
                                val = $.inArray(filtered[0], dates[language].months) + 1;
                                break;
                            case 'M':
                                filtered = $(dates[language].monthsShort).filter(match_part);
                                val = $.inArray(filtered[0], dates[language].monthsShort) + 1;
                                break;
                        }
                    }
                    parsed[part] = val;
                }
                var _date, s;
                for (i = 0; i < setters_order.length; i++) {
                    s = setters_order[i];
                    if (s in parsed && !isNaN(parsed[s])) {
                        _date = new Date(date);
                        setters_map[s](_date, parsed[s]);
                        if (!isNaN(_date))
                            date = _date;
                    }
                }
            }
            return date;
        },
        formatDate: function (date, format, language) {
            if (!date)
                return '';
            if (typeof format === 'string')
                format = DPGlobal.parseFormat(format);
            var val = {
                d: date.getUTCDate(),
                D: dates[language].daysShort[date.getUTCDay()],
                DD: dates[language].days[date.getUTCDay()],
                m: date.getUTCMonth() + 1,
                M: dates[language].monthsShort[date.getUTCMonth()],
                MM: dates[language].months[date.getUTCMonth()],
                yy: date.getUTCFullYear().toString().substring(2),
                yyyy: date.getUTCFullYear()
            };
            val.dd = (val.d < 10 ? '0' : '') + val.d;
            val.mm = (val.m < 10 ? '0' : '') + val.m;
            date = [];
            var seps = $.extend([], format.separators);
            for (var i = 0, cnt = format.parts.length; i <= cnt; i++) {
                if (seps.length)
                    date.push(seps.shift());
                date.push(val[format.parts[i]]);
            }
            return date.join('');
        },
        headTemplate: '<thead>' +
							'<tr>' +
								'<th class="prev">&#171;</th>' +
								'<th colspan="5" class="datepicker-switch"></th>' +
								'<th class="next">&#187;</th>' +
							'</tr>' +
						'</thead>',
        contTemplate: '<tbody><tr><td colspan="7"></td></tr></tbody>',
        footTemplate: '<tfoot>' +
							'<tr>' +
								'<th colspan="7" class="today"></th>' +
							'</tr>' +
							'<tr>' +
								'<th colspan="7" class="clear"></th>' +
							'</tr>' +
						'</tfoot>'
    };
    DPGlobal.template = '<div class="datepicker">' +
							'<div class="datepicker-days">' +
								'<table class=" table-condensed">' +
									DPGlobal.headTemplate +
									'<tbody></tbody>' +
									DPGlobal.footTemplate +
								'</table>' +
							'</div>' +
							'<div class="datepicker-months">' +
								'<table class="table-condensed">' +
									DPGlobal.headTemplate +
									DPGlobal.contTemplate +
									DPGlobal.footTemplate +
								'</table>' +
							'</div>' +
							'<div class="datepicker-years">' +
								'<table class="table-condensed">' +
									DPGlobal.headTemplate +
									DPGlobal.contTemplate +
									DPGlobal.footTemplate +
								'</table>' +
							'</div>' +
						'</div>';

    $.fn.datepicker.DPGlobal = DPGlobal;


    /* DATEPICKER NO CONFLICT
	* =================== */

    $.fn.datepicker.noConflict = function () {
        $.fn.datepicker = old;
        return this;
    };


    /* DATEPICKER DATA-API
	* ================== */

    $(document).on(
		'focus.datepicker.data-api click.datepicker.data-api',
		'[data-provide="datepicker"]',
		function (e) {
		    var $this = $(this);
		    if ($this.data('datepicker'))
		        return;
		    e.preventDefault();
		    // component click requires us to explicitly show it
		    datepickerPlugin.call($this, 'show');
		}
	);
    $(function () {
        datepickerPlugin.call($('[data-provide="datepicker-inline"]'));
    });

}(window.jQuery));
;
/*

Tooltipster 3.3.0 | 2014-11-08
A rockin' custom tooltip jQuery plugin

Developed by Caleb Jacob under the MIT license http://opensource.org/licenses/MIT

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

*/

;
(function ($, window, document) {

    var pluginName = "tooltipster",
        defaults = {
            animation: 'fade',
            arrow: true,
            arrowColor: '',
            autoClose: true,
            content: null,
            contentAsHTML: false,
            contentCloning: true,
            debug: true,
            delay: 200,
            minWidth: 0,
            maxWidth: null,
            functionInit: function (origin, content) { },
            functionBefore: function (origin, continueTooltip) {
                continueTooltip();
            },
            functionReady: function (origin, tooltip) { },
            functionAfter: function (origin) { },
            hideOnClick: false,
            icon: '(?)',
            iconCloning: true,
            iconDesktop: false,
            iconTouch: false,
            iconTheme: 'tooltipster-icon',
            interactive: false,
            interactiveTolerance: 350,
            multiple: false,
            offsetX: 0,
            offsetY: 0,
            onlyOne: false,
            position: 'top',
            positionTracker: false,
            positionTrackerCallback: function (origin) {
                // the default tracker callback will close the tooltip when the trigger is
                // 'hover' (see https://github.com/iamceege/tooltipster/pull/253)
                if (this.option('trigger') == 'hover' && this.option('autoClose')) {
                    this.hide();
                }
            },
            restoration: 'current',
            speed: 350,
            timer: 0,
            theme: 'tooltipster-default',
            touchDevices: true,
            trigger: 'hover',
            updateAnimation: true
        };

    function Plugin(element, options) {

        // list of instance variables
        this.bodyOverflowX;
        // stack of custom callbacks provided as parameters to API methods
        this.callbacks = {
            hide: [],
            show: []
        };
        this.checkInterval = null;
        // this will be the user content shown in the tooltip. A capital "C" is used because there is also a method called content()
        this.Content;
        // this is the original element which is being applied the tooltipster plugin
        this.$el = $(element);
        // this will be the element which triggers the appearance of the tooltip on hover/click/custom events.
        // it will be the same as this.$el if icons are not used (see in the options), otherwise it will correspond to the created icon
        this.$elProxy;
        this.elProxyPosition;
        this.enabled = true;
        this.options = $.extend({}, defaults, options);
        this.mouseIsOverProxy = false;
        // a unique namespace per instance, for easy selective unbinding
        this.namespace = 'tooltipster-' + Math.round(Math.random() * 100000);
        // Status (capital S) can be either : appearing, shown, disappearing, hidden
        this.Status = 'hidden';
        this.timerHide = null;
        this.timerShow = null;
        // this will be the tooltip element (jQuery wrapped HTML element)
        this.$tooltip;

        // for backward compatibility
        this.options.iconTheme = this.options.iconTheme.replace('.', '');
        this.options.theme = this.options.theme.replace('.', '');

        // launch
        this._init();
    }

    Plugin.prototype = {

        _init: function () {

            var self = this;

            // disable the plugin on old browsers (including IE7 and lower)
            if (document.querySelector) {

                // note : the content is null (empty) by default and can stay that way if the plugin remains initialized but not fed any content. The tooltip will just not appear.
                // let's save the initial value of the title attribute for later restoration if need be.
                var initialTitle = null;
                // it will already have been saved in case of multiple tooltips
                if (self.$el.data('tooltipster-initialTitle') === undefined) {

                    initialTitle = self.$el.attr('title');

                    // we do not want initialTitle to have the value "undefined" because of how jQuery's .data() method works
                    if (initialTitle === undefined) initialTitle = null;

                    self.$el.data('tooltipster-initialTitle', initialTitle);
                }

                // if content is provided in the options, its has precedence over the title attribute.
                // Note : an empty string is considered content, only 'null' represents the absence of content.
                // Also, an existing title="" attribute will result in an empty string content
                if (self.options.content !== null) {
                    self._content_set(self.options.content);
                } else {
                    self._content_set(initialTitle);
                }

                var c = self.options.functionInit.call(self.$el, self.$el, self.Content);
                if (typeof c !== 'undefined') self._content_set(c);

                self.$el
                // strip the title off of the element to prevent the default tooltips from popping up
                .removeAttr('title')
                // to be able to find all instances on the page later (upon window events in particular)
                .addClass('tooltipstered');

                // detect if we're changing the tooltip origin to an icon
                // note about this condition : if the device has touch capability and self.options.iconTouch is false, you'll have no icons event though you may consider your device as a desktop if it also has a mouse. Not sure why someone would have this use case though.
                if ((!deviceHasTouchCapability && self.options.iconDesktop) || (deviceHasTouchCapability && self.options.iconTouch)) {

                    // TODO : the tooltip should be automatically be given an absolute position to be near the origin. Otherwise, when the origin is floating or what, it's going to be nowhere near it and disturb the position flow of the page elements. It will imply that the icon also detects when its origin moves, to follow it : not trivial.
                    // Until it's done, the icon feature does not really make sense since the user still has most of the work to do by himself
                    // if the icon provided is in the form of a string
                    if (typeof self.options.icon === 'string') {
                        // wrap it in a span with the icon class
                        self.$elProxy = $('<span class="' + self.options.iconTheme + '"></span>');
                        self.$elProxy.text(self.options.icon);
                    }
                        // if it is an object (sensible choice)
                    else {
                        // (deep) clone the object if iconCloning == true, to make sure every instance has its own proxy. We use the icon without wrapping, no need to. We do not give it a class either, as the user will undoubtedly style the object on his own and since our css properties may conflict with his own
                        if (self.options.iconCloning) self.$elProxy = self.options.icon.clone(true);
                        else self.$elProxy = self.options.icon;
                    }

                    self.$elProxy.insertAfter(self.$el);
                } else {
                    self.$elProxy = self.$el;
                }

                // for 'click' and 'hover' triggers : bind on events to open the tooltip. Closing is now handled in _showNow() because of its bindings.
                // Notes about touch events :
                // - mouseenter, mouseleave and clicks happen even on pure touch devices because they are emulated. deviceIsPureTouch() is a simple attempt to detect them.
                // - on hybrid devices, we do not prevent touch gesture from opening tooltips. It would be too complex to differentiate real mouse events from emulated ones.
                // - we check deviceIsPureTouch() at each event rather than prior to binding because the situation may change during browsing
                if (self.options.trigger == 'hover') {

                    // these binding are for mouse interaction only
                    self.$elProxy.on('mouseenter.' + self.namespace, function () {
                        if (!deviceIsPureTouch() || self.options.touchDevices) {
                            self.mouseIsOverProxy = true;
                            self._show();
                        }
                    }).on('mouseleave.' + self.namespace, function () {
                        if (!deviceIsPureTouch() || self.options.touchDevices) {
                            self.mouseIsOverProxy = false;
                        }
                    });

                    // for touch interaction only
                    if (deviceHasTouchCapability && self.options.touchDevices) {

                        // for touch devices, we immediately display the tooltip because we cannot rely on mouseleave to handle the delay
                        self.$elProxy.on('touchstart.' + self.namespace, function () {
                            self._showNow();
                        });
                    }
                } else if (self.options.trigger == 'click') {

                    // note : for touch devices, we do not bind on touchstart, we only rely on the emulated clicks (triggered by taps)
                    self.$elProxy.on('click.' + self.namespace, function () {
                        if (!deviceIsPureTouch() || self.options.touchDevices) {
                            self._show();
                        }
                    });
                }
            }
        },

        // this function will schedule the opening of the tooltip after the delay, if there is one
        _show: function () {

            var self = this;

            if (self.Status != 'shown' && self.Status != 'appearing') {

                if (self.options.delay) {
                    self.timerShow = setTimeout(function () {

                        // for hover trigger, we check if the mouse is still over the proxy, otherwise we do not show anything
                        if (self.options.trigger == 'click' || (self.options.trigger == 'hover' && self.mouseIsOverProxy)) {
                            self._showNow();
                        }
                    }, self.options.delay);
                } else self._showNow();
            }
        },

        // this function will open the tooltip right away
        _showNow: function (callback) {

            var self = this;

            // call our constructor custom function before continuing
            self.options.functionBefore.call(self.$el, self.$el, function () {

                // continue only if the tooltip is enabled and has any content
                if (self.enabled && self.Content !== null) {

                    // save the method callback and cancel hide method callbacks
                    if (callback) self.callbacks.show.push(callback);
                    self.callbacks.hide = [];

                    //get rid of any appearance timer
                    clearTimeout(self.timerShow);
                    self.timerShow = null;
                    clearTimeout(self.timerHide);
                    self.timerHide = null;

                    // if we only want one tooltip open at a time, close all auto-closing tooltips currently open and not already disappearing
                    if (self.options.onlyOne) {
                        $('.tooltipstered').not(self.$el).each(function (i, el) {

                            var $el = $(el),
                                nss = $el.data('tooltipster-ns');

                            // iterate on all tooltips of the element
                            $.each(nss, function (i, ns) {
                                var instance = $el.data(ns),


                                    // we have to use the public methods here
                                    s = instance.status(),
                                    ac = instance.option('autoClose');

                                if (s !== 'hidden' && s !== 'disappearing' && ac) {
                                    instance.hide();
                                }
                            });
                        });
                    }

                    var finish = function () {
                        self.Status = 'shown';

                        // trigger any show method custom callbacks and reset them
                        $.each(self.callbacks.show, function (i, c) {
                            c.call(self.$el);
                        });
                        self.callbacks.show = [];
                    };

                    // if this origin already has its tooltip open
                    if (self.Status !== 'hidden') {

                        // the timer (if any) will start (or restart) right now
                        var extraTime = 0;

                        // if it was disappearing, cancel that
                        if (self.Status === 'disappearing') {

                            self.Status = 'appearing';

                            if (supportsTransitions()) {

                                self.$tooltip.clearQueue().removeClass('tooltipster-dying').addClass('tooltipster-' + self.options.animation + '-show');

                                if (self.options.speed > 0) self.$tooltip.delay(self.options.speed);

                                self.$tooltip.queue(finish);
                            } else {
                                // in case the tooltip was currently fading out, bring it back to life
                                self.$tooltip.stop().fadeIn(finish);
                            }
                        }
                            // if the tooltip is already open, we still need to trigger the method custom callback
                        else if (self.Status === 'shown') {
                            finish();
                        }
                    }
                        // if the tooltip isn't already open, open that sucker up!
                    else {

                        self.Status = 'appearing';

                        // the timer (if any) will start when the tooltip has fully appeared after its transition
                        var extraTime = self.options.speed;

                        // disable horizontal scrollbar to keep overflowing tooltips from jacking with it and then restore it to its previous value
                        self.bodyOverflowX = $('body').css('overflow-x');
                        $('body').css('overflow-x', 'hidden');

                        // get some other settings related to building the tooltip
                        var animation = 'tooltipster-' + self.options.animation,
                            animationSpeed = '-webkit-transition-duration: ' + self.options.speed + 'ms; -webkit-animation-duration: ' + self.options.speed + 'ms; -moz-transition-duration: ' + self.options.speed + 'ms; -moz-animation-duration: ' + self.options.speed + 'ms; -o-transition-duration: ' + self.options.speed + 'ms; -o-animation-duration: ' + self.options.speed + 'ms; -ms-transition-duration: ' + self.options.speed + 'ms; -ms-animation-duration: ' + self.options.speed + 'ms; transition-duration: ' + self.options.speed + 'ms; animation-duration: ' + self.options.speed + 'ms;',
                            minWidth = self.options.minWidth ? 'min-width:' + Math.round(self.options.minWidth) + 'px;' : '',
                            maxWidth = self.options.maxWidth ? 'max-width:' + Math.round(self.options.maxWidth) + 'px;' : '',
                            pointerEvents = self.options.interactive ? 'pointer-events: auto;' : '';

                        // build the base of our tooltip
                        self.$tooltip = $('<div class="tooltipster-base ' + self.options.theme + '" style="' + minWidth + ' ' + maxWidth + ' ' + pointerEvents + ' ' + animationSpeed + '"><div class="tooltipster-content"></div></div>');

                        // only add the animation class if the user has a browser that supports animations
                        if (supportsTransitions()) self.$tooltip.addClass(animation);

                        // insert the content
                        self._content_insert();

                        // attach
                        self.$tooltip.appendTo('body');

                        // do all the crazy calculations and positioning
                        self.reposition();

                        // call our custom callback since the content of the tooltip is now part of the DOM
                        self.options.functionReady.call(self.$el, self.$el, self.$tooltip);

                        // animate in the tooltip
                        if (supportsTransitions()) {

                            self.$tooltip.addClass(animation + '-show');

                            if (self.options.speed > 0) self.$tooltip.delay(self.options.speed);

                            self.$tooltip.queue(finish);
                        } else {
                            self.$tooltip.css('display', 'none').fadeIn(self.options.speed, finish);
                        }

                        // will check if our tooltip origin is removed while the tooltip is shown
                        self._interval_set();

                        // reposition on scroll (otherwise position:fixed element's tooltips will move away form their origin) and on resize (in case position can/has to be changed)
                        $(window).on('scroll.' + self.namespace + ' resize.' + self.namespace, function () {
                            self.reposition();
                        });

                        // auto-close bindings
                        if (self.options.autoClose) {

                            // in case a listener is already bound for autoclosing (mouse or touch, hover or click), unbind it first
                            $('body').off('.' + self.namespace);

                            // here we'll have to set different sets of bindings for both touch and mouse
                            if (self.options.trigger == 'hover') {

                                // if the user touches the body, hide
                                if (deviceHasTouchCapability) {
                                    // timeout 0 : explanation below in click section
                                    setTimeout(function () {
                                        // we don't want to bind on click here because the initial touchstart event has not yet triggered its click event, which is thus about to happen
                                        $('body').on('touchstart.' + self.namespace, function () {
                                            self.hide();
                                        });
                                    }, 0);
                                }

                                // if we have to allow interaction
                                if (self.options.interactive) {

                                    // touch events inside the tooltip must not close it
                                    if (deviceHasTouchCapability) {
                                        self.$tooltip.on('touchstart.' + self.namespace, function (event) {
                                            event.stopPropagation();
                                        });
                                    }

                                    // as for mouse interaction, we get rid of the tooltip only after the mouse has spent some time out of it
                                    var tolerance = null;

                                    self.$elProxy.add(self.$tooltip)
                                    // hide after some time out of the proxy and the tooltip
                                    .on('mouseleave.' + self.namespace + '-autoClose', function () {
                                        clearTimeout(tolerance);
                                        tolerance = setTimeout(function () {
                                            self.hide();
                                        }, self.options.interactiveTolerance);
                                    })
                                    // suspend timeout when the mouse is over the proxy or the tooltip
                                    .on('mouseenter.' + self.namespace + '-autoClose', function () {
                                        clearTimeout(tolerance);
                                    });
                                }
                                    // if this is a non-interactive tooltip, get rid of it if the mouse leaves
                                else {
                                    self.$elProxy.on('mouseleave.' + self.namespace + '-autoClose', function () {
                                        self.hide();
                                    });
                                }

                                // close the tooltip when the proxy gets a click (common behavior of native tooltips)
                                if (self.options.hideOnClick) {

                                    self.$elProxy.on('click.' + self.namespace + '-autoClose', function () {
                                        self.hide();
                                    });
                                }
                            }
                                // here we'll set the same bindings for both clicks and touch on the body to hide the tooltip
                            else if (self.options.trigger == 'click') {

                                // use a timeout to prevent immediate closing if the method was called on a click event and if options.delay == 0 (because of bubbling)
                                setTimeout(function () {
                                    $('body').on('click.' + self.namespace + ' touchstart.' + self.namespace, function () {
                                        self.hide();
                                    });
                                }, 0);

                                // if interactive, we'll stop the events that were emitted from inside the tooltip to stop autoClosing
                                if (self.options.interactive) {

                                    // note : the touch events will just not be used if the plugin is not enabled on touch devices
                                    self.$tooltip.on('click.' + self.namespace + ' touchstart.' + self.namespace, function (event) {
                                        event.stopPropagation();
                                    });
                                }
                            }
                        }
                    }

                    // if we have a timer set, let the countdown begin
                    if (self.options.timer > 0) {

                        self.timerHide = setTimeout(function () {
                            self.timerHide = null;
                            self.hide();
                        }, self.options.timer + extraTime);
                    }
                }
            });
        },

        _interval_set: function () {

            var self = this;

            self.checkInterval = setInterval(function () {

                // if the tooltip and/or its interval should be stopped
                if (
                    // if the origin has been removed
                $('body').find(self.$el).length === 0
                    // if the elProxy has been removed
                || $('body').find(self.$elProxy).length === 0
                    // if the tooltip has been closed
                || self.Status == 'hidden'
                    // if the tooltip has somehow been removed
                || $('body').find(self.$tooltip).length === 0) {
                    // remove the tooltip if it's still here
                    if (self.Status == 'shown' || self.Status == 'appearing') self.hide();

                    // clear this interval as it is no longer necessary
                    self._interval_cancel();
                }
                    // if everything is alright
                else {
                    // compare the former and current positions of the elProxy to reposition the tooltip if need be
                    if (self.options.positionTracker) {

                        var p = self._repositionInfo(self.$elProxy),
                            identical = false;

                        // compare size first (a change requires repositioning too)
                        if (areEqual(p.dimension, self.elProxyPosition.dimension)) {

                            // for elements with a fixed position, we track the top and left properties (relative to window)
                            if (self.$elProxy.css('position') === 'fixed') {
                                if (areEqual(p.position, self.elProxyPosition.position)) identical = true;
                            }
                                // otherwise, track total offset (relative to document)
                            else {
                                if (areEqual(p.offset, self.elProxyPosition.offset)) identical = true;
                            }
                        }

                        if (!identical) {
                            self.reposition();
                            self.options.positionTrackerCallback.call(self, self.$el);
                        }
                    }
                }
            }, 200);
        },

        _interval_cancel: function () {
            clearInterval(this.checkInterval);
            // clean delete
            this.checkInterval = null;
        },

        _content_set: function (content) {
            // clone if asked. Cloning the object makes sure that each instance has its own version of the content (in case a same object were provided for several instances)
            // reminder : typeof null === object
            if (typeof content === 'object' && content !== null && this.options.contentCloning) {
                content = content.clone(true);
            }
            this.Content = content;
        },

        _content_insert: function () {

            var self = this,
                $d = this.$tooltip.find('.tooltipster-content');

            if (typeof self.Content === 'string' && !self.options.contentAsHTML) {
                $d.text(self.Content);
            } else {
                $d.empty().append(self.Content);
            }
        },

        _update: function (content) {

            var self = this;

            // change the content
            self._content_set(content);

            if (self.Content !== null) {

                // update the tooltip if it is open
                if (self.Status !== 'hidden') {

                    // reset the content in the tooltip
                    self._content_insert();

                    // reposition and resize the tooltip
                    self.reposition();

                    // if we want to play a little animation showing the content changed
                    if (self.options.updateAnimation) {

                        if (supportsTransitions()) {

                            self.$tooltip.css({
                                'width': '',
                                '-webkit-transition': 'all ' + self.options.speed + 'ms, width 0ms, height 0ms, left 0ms, top 0ms',
                                '-moz-transition': 'all ' + self.options.speed + 'ms, width 0ms, height 0ms, left 0ms, top 0ms',
                                '-o-transition': 'all ' + self.options.speed + 'ms, width 0ms, height 0ms, left 0ms, top 0ms',
                                '-ms-transition': 'all ' + self.options.speed + 'ms, width 0ms, height 0ms, left 0ms, top 0ms',
                                'transition': 'all ' + self.options.speed + 'ms, width 0ms, height 0ms, left 0ms, top 0ms'
                            }).addClass('tooltipster-content-changing');

                            // reset the CSS transitions and finish the change animation
                            setTimeout(function () {

                                if (self.Status != 'hidden') {

                                    self.$tooltip.removeClass('tooltipster-content-changing');

                                    // after the changing animation has completed, reset the CSS transitions
                                    setTimeout(function () {

                                        if (self.Status !== 'hidden') {
                                            self.$tooltip.css({
                                                '-webkit-transition': self.options.speed + 'ms',
                                                '-moz-transition': self.options.speed + 'ms',
                                                '-o-transition': self.options.speed + 'ms',
                                                '-ms-transition': self.options.speed + 'ms',
                                                'transition': self.options.speed + 'ms'
                                            });
                                        }
                                    }, self.options.speed);
                                }
                            }, self.options.speed);
                        } else {
                            self.$tooltip.fadeTo(self.options.speed, 0.5, function () {
                                if (self.Status != 'hidden') {
                                    self.$tooltip.fadeTo(self.options.speed, 1);
                                }
                            });
                        }
                    }
                }
            } else {
                self.hide();
            }
        },

        _repositionInfo: function ($el) {
            return {
                dimension: {
                    height: $el.outerHeight(false),
                    width: $el.outerWidth(false)
                },
                offset: $el.offset(),
                position: {
                    left: parseInt($el.css('left')),
                    top: parseInt($el.css('top'))
                }
            };
        },

        hide: function (callback) {

            var self = this;

            // save the method custom callback and cancel any show method custom callbacks
            if (callback) self.callbacks.hide.push(callback);
            self.callbacks.show = [];

            // get rid of any appearance timeout
            clearTimeout(self.timerShow);
            self.timerShow = null;
            clearTimeout(self.timerHide);
            self.timerHide = null;

            var finishCallbacks = function () {
                // trigger any hide method custom callbacks and reset them
                $.each(self.callbacks.hide, function (i, c) {
                    c.call(self.$el);
                });
                self.callbacks.hide = [];
            };

            // hide
            if (self.Status == 'shown' || self.Status == 'appearing') {

                self.Status = 'disappearing';

                var finish = function () {

                    self.Status = 'hidden';

                    // detach our content object first, so the next jQuery's remove() call does not unbind its event handlers
                    if (typeof self.Content == 'object' && self.Content !== null) {
                        self.Content.detach();
                    }

                    self.$tooltip.remove();
                    self.$tooltip = null;

                    // unbind orientationchange, scroll and resize listeners
                    $(window).off('.' + self.namespace);

                    $('body')
                    // unbind any auto-closing click/touch listeners
                    .off('.' + self.namespace).css('overflow-x', self.bodyOverflowX);

                    // unbind any auto-closing click/touch listeners
                    $('body').off('.' + self.namespace);

                    // unbind any auto-closing hover listeners
                    self.$elProxy.off('.' + self.namespace + '-autoClose');

                    // call our constructor custom callback function
                    self.options.functionAfter.call(self.$el, self.$el);

                    // call our method custom callbacks functions
                    finishCallbacks();
                };

                if (supportsTransitions()) {

                    self.$tooltip.clearQueue().removeClass('tooltipster-' + self.options.animation + '-show')
                    // for transitions only
                    .addClass('tooltipster-dying');

                    if (self.options.speed > 0) self.$tooltip.delay(self.options.speed);

                    self.$tooltip.queue(finish);
                } else {
                    self.$tooltip.stop().fadeOut(self.options.speed, finish);
                }
            }
                // if the tooltip is already hidden, we still need to trigger the method custom callback
            else if (self.Status == 'hidden') {
                finishCallbacks();
            }

            return self;
        },

        // the public show() method is actually an alias for the private showNow() method
        show: function (callback) {
            this._showNow(callback);
            return this;
        },

        // 'update' is deprecated in favor of 'content' but is kept for backward compatibility
        update: function (c) {
            return this.content(c);
        },
        content: function (c) {
            // getter method
            if (typeof c === 'undefined') {
                return this.Content;
            }
                // setter method
            else {
                this._update(c);
                return this;
            }
        },

        reposition: function () {

            var self = this;

            // in case the tooltip has been removed from DOM manually
            if ($('body').find(self.$tooltip).length !== 0) {

                // reset width
                self.$tooltip.css('width', '');

                // find variables to determine placement
                self.elProxyPosition = self._repositionInfo(self.$elProxy);
                var arrowReposition = null,
                    windowWidth = $(window).width(),


                    // shorthand
                    proxy = self.elProxyPosition,
                    tooltipWidth = self.$tooltip.outerWidth(false),
                    tooltipInnerWidth = self.$tooltip.innerWidth() + 1,
                     // this +1 stops FireFox from sometimes forcing an additional text line
                    tooltipHeight = self.$tooltip.outerHeight(false);

                // if this is an <area> tag inside a <map>, all hell breaks loose. Recalculate all the measurements based on coordinates
                if (self.$elProxy.is('area')) {
                    var areaShape = self.$elProxy.attr('shape'),
                        mapName = self.$elProxy.parent().attr('name'),
                        map = $('img[usemap="#' + mapName + '"]'),
                        mapOffsetLeft = map.offset().left,
                        mapOffsetTop = map.offset().top,
                        areaMeasurements = self.$elProxy.attr('coords') !== undefined ? self.$elProxy.attr('coords').split(',') : undefined;

                    if (areaShape == 'circle') {
                        var areaLeft = parseInt(areaMeasurements[0]),
                            areaTop = parseInt(areaMeasurements[1]),
                            areaWidth = parseInt(areaMeasurements[2]);
                        proxy.dimension.height = areaWidth * 2;
                        proxy.dimension.width = areaWidth * 2;
                        proxy.offset.top = mapOffsetTop + areaTop - areaWidth;
                        proxy.offset.left = mapOffsetLeft + areaLeft - areaWidth;
                    } else if (areaShape == 'rect') {
                        var areaLeft = parseInt(areaMeasurements[0]),
                            areaTop = parseInt(areaMeasurements[1]),
                            areaRight = parseInt(areaMeasurements[2]),
                            areaBottom = parseInt(areaMeasurements[3]);
                        proxy.dimension.height = areaBottom - areaTop;
                        proxy.dimension.width = areaRight - areaLeft;
                        proxy.offset.top = mapOffsetTop + areaTop;
                        proxy.offset.left = mapOffsetLeft + areaLeft;
                    } else if (areaShape == 'poly') {
                        var areaXs = [],
                            areaYs = [],
                            areaSmallestX = 0,
                            areaSmallestY = 0,
                            areaGreatestX = 0,
                            areaGreatestY = 0,
                            arrayAlternate = 'even';

                        for (var i = 0; i < areaMeasurements.length; i++) {
                            var areaNumber = parseInt(areaMeasurements[i]);

                            if (arrayAlternate == 'even') {
                                if (areaNumber > areaGreatestX) {
                                    areaGreatestX = areaNumber;
                                    if (i === 0) {
                                        areaSmallestX = areaGreatestX;
                                    }
                                }

                                if (areaNumber < areaSmallestX) {
                                    areaSmallestX = areaNumber;
                                }

                                arrayAlternate = 'odd';
                            } else {
                                if (areaNumber > areaGreatestY) {
                                    areaGreatestY = areaNumber;
                                    if (i == 1) {
                                        areaSmallestY = areaGreatestY;
                                    }
                                }

                                if (areaNumber < areaSmallestY) {
                                    areaSmallestY = areaNumber;
                                }

                                arrayAlternate = 'even';
                            }
                        }

                        proxy.dimension.height = areaGreatestY - areaSmallestY;
                        proxy.dimension.width = areaGreatestX - areaSmallestX;
                        proxy.offset.top = mapOffsetTop + areaSmallestY;
                        proxy.offset.left = mapOffsetLeft + areaSmallestX;
                    } else {
                        proxy.dimension.height = map.outerHeight(false);
                        proxy.dimension.width = map.outerWidth(false);
                        proxy.offset.top = mapOffsetTop;
                        proxy.offset.left = mapOffsetLeft;
                    }
                }

                // our function and global vars for positioning our tooltip
                var myLeft = 0,
                    myLeftMirror = 0,
                    myTop = 0,
                    offsetY = parseInt(self.options.offsetY),
                    offsetX = parseInt(self.options.offsetX),


                    // this is the arrow position that will eventually be used. It may differ from the position option if the tooltip cannot be displayed in this position
                    practicalPosition = self.options.position;

                // a function to detect if the tooltip is going off the screen horizontally. If so, reposition the crap out of it!


                function dontGoOffScreenX() {

                    var windowLeft = $(window).scrollLeft();

                    // if the tooltip goes off the left side of the screen, line it up with the left side of the window
                    if ((myLeft - windowLeft) < 0) {
                        arrowReposition = myLeft - windowLeft;
                        myLeft = windowLeft;
                    }

                    // if the tooltip goes off the right of the screen, line it up with the right side of the window
                    if (((myLeft + tooltipWidth) - windowLeft) > windowWidth) {
                        arrowReposition = myLeft - ((windowWidth + windowLeft) - tooltipWidth);
                        myLeft = (windowWidth + windowLeft) - tooltipWidth;
                    }
                }

                // a function to detect if the tooltip is going off the screen vertically. If so, switch to the opposite!


                function dontGoOffScreenY(switchTo, switchFrom) {
                    // if it goes off the top off the page
                    if (((proxy.offset.top - $(window).scrollTop() - tooltipHeight - offsetY - 12) < 0) && (switchFrom.indexOf('top') > -1)) {
                        practicalPosition = switchTo;
                    }

                    // if it goes off the bottom of the page
                    if (((proxy.offset.top + proxy.dimension.height + tooltipHeight + 12 + offsetY) > ($(window).scrollTop() + $(window).height())) && (switchFrom.indexOf('bottom') > -1)) {
                        practicalPosition = switchTo;
                        myTop = (proxy.offset.top - tooltipHeight) - offsetY - 12;
                    }
                }

                if (practicalPosition == 'top') {
                    var leftDifference = (proxy.offset.left + tooltipWidth) - (proxy.offset.left + proxy.dimension.width);
                    myLeft = (proxy.offset.left + offsetX) - (leftDifference / 2);
                    myTop = (proxy.offset.top - tooltipHeight) - offsetY - 12;
                    dontGoOffScreenX();
                    dontGoOffScreenY('bottom', 'top');
                }

                if (practicalPosition == 'top-left') {
                    myLeft = proxy.offset.left + offsetX;
                    myTop = (proxy.offset.top - tooltipHeight) - offsetY - 12;
                    dontGoOffScreenX();
                    dontGoOffScreenY('bottom-left', 'top-left');
                }

                if (practicalPosition == 'top-right') {
                    myLeft = (proxy.offset.left + proxy.dimension.width + offsetX) - tooltipWidth;
                    myTop = (proxy.offset.top - tooltipHeight) - offsetY - 12;
                    dontGoOffScreenX();
                    dontGoOffScreenY('bottom-right', 'top-right');
                }

                if (practicalPosition == 'bottom') {
                    var leftDifference = (proxy.offset.left + tooltipWidth) - (proxy.offset.left + proxy.dimension.width);
                    myLeft = proxy.offset.left - (leftDifference / 2) + offsetX;
                    myTop = (proxy.offset.top + proxy.dimension.height) + offsetY + 12;
                    dontGoOffScreenX();
                    dontGoOffScreenY('top', 'bottom');
                }

                if (practicalPosition == 'bottom-left') {
                    myLeft = proxy.offset.left + offsetX;
                    myTop = (proxy.offset.top + proxy.dimension.height) + offsetY + 12;
                    dontGoOffScreenX();
                    dontGoOffScreenY('top-left', 'bottom-left');
                }

                if (practicalPosition == 'bottom-right') {
                    myLeft = (proxy.offset.left + proxy.dimension.width + offsetX) - tooltipWidth;
                    myTop = (proxy.offset.top + proxy.dimension.height) + offsetY + 12;
                    dontGoOffScreenX();
                    dontGoOffScreenY('top-right', 'bottom-right');
                }

                if (practicalPosition == 'left') {
                    myLeft = proxy.offset.left - offsetX - tooltipWidth - 12;
                    myLeftMirror = proxy.offset.left + offsetX + proxy.dimension.width + 12;
                    var topDifference = (proxy.offset.top + tooltipHeight) - (proxy.offset.top + proxy.dimension.height);
                    myTop = proxy.offset.top - (topDifference / 2) - offsetY;

                    // if the tooltip goes off boths sides of the page
                    if ((myLeft < 0) && ((myLeftMirror + tooltipWidth) > windowWidth)) {
                        var borderWidth = parseFloat(self.$tooltip.css('border-width')) * 2,
                            newWidth = (tooltipWidth + myLeft) - borderWidth;
                        self.$tooltip.css('width', newWidth + 'px');

                        tooltipHeight = self.$tooltip.outerHeight(false);
                        myLeft = proxy.offset.left - offsetX - newWidth - 12 - borderWidth;
                        topDifference = (proxy.offset.top + tooltipHeight) - (proxy.offset.top + proxy.dimension.height);
                        myTop = proxy.offset.top - (topDifference / 2) - offsetY;
                    }

                        // if it only goes off one side, flip it to the other side
                    else if (myLeft < 0) {
                        myLeft = proxy.offset.left + offsetX + proxy.dimension.width + 12;
                        arrowReposition = 'left';
                    }
                }

                if (practicalPosition == 'right') {
                    myLeft = proxy.offset.left + offsetX + proxy.dimension.width + 12;
                    myLeftMirror = proxy.offset.left - offsetX - tooltipWidth - 12;
                    var topDifference = (proxy.offset.top + tooltipHeight) - (proxy.offset.top + proxy.dimension.height);
                    myTop = proxy.offset.top - (topDifference / 2) - offsetY;

                    // if the tooltip goes off boths sides of the page
                    if (((myLeft + tooltipWidth) > windowWidth) && (myLeftMirror < 0)) {
                        var borderWidth = parseFloat(self.$tooltip.css('border-width')) * 2,
                            newWidth = (windowWidth - myLeft) - borderWidth;
                        self.$tooltip.css('width', newWidth + 'px');

                        tooltipHeight = self.$tooltip.outerHeight(false);
                        topDifference = (proxy.offset.top + tooltipHeight) - (proxy.offset.top + proxy.dimension.height);
                        myTop = proxy.offset.top - (topDifference / 2) - offsetY;
                    }

                        // if it only goes off one side, flip it to the other side
                    else if ((myLeft + tooltipWidth) > windowWidth) {
                        myLeft = proxy.offset.left - offsetX - tooltipWidth - 12;
                        arrowReposition = 'right';
                    }
                }

                // if arrow is set true, style it and append it
                if (self.options.arrow) {

                    var arrowClass = 'tooltipster-arrow-' + practicalPosition;

                    // set color of the arrow
                    if (self.options.arrowColor.length < 1) {
                        var arrowColor = self.$tooltip.css('background-color');
                    } else {
                        var arrowColor = self.options.arrowColor;
                    }

                    // if the tooltip was going off the page and had to re-adjust, we need to update the arrow's position
                    if (!arrowReposition) {
                        arrowReposition = '';
                    } else if (arrowReposition == 'left') {
                        arrowClass = 'tooltipster-arrow-right';
                        arrowReposition = '';
                    } else if (arrowReposition == 'right') {
                        arrowClass = 'tooltipster-arrow-left';
                        arrowReposition = '';
                    } else {
                        arrowReposition = 'left:' + Math.round(arrowReposition) + 'px;';
                    }

                    // building the logic to create the border around the arrow of the tooltip
                    if ((practicalPosition == 'top') || (practicalPosition == 'top-left') || (practicalPosition == 'top-right')) {
                        var tooltipBorderWidth = parseFloat(self.$tooltip.css('border-bottom-width')),
                            tooltipBorderColor = self.$tooltip.css('border-bottom-color');
                    } else if ((practicalPosition == 'bottom') || (practicalPosition == 'bottom-left') || (practicalPosition == 'bottom-right')) {
                        var tooltipBorderWidth = parseFloat(self.$tooltip.css('border-top-width')),
                            tooltipBorderColor = self.$tooltip.css('border-top-color');
                    } else if (practicalPosition == 'left') {
                        var tooltipBorderWidth = parseFloat(self.$tooltip.css('border-right-width')),
                            tooltipBorderColor = self.$tooltip.css('border-right-color');
                    } else if (practicalPosition == 'right') {
                        var tooltipBorderWidth = parseFloat(self.$tooltip.css('border-left-width')),
                            tooltipBorderColor = self.$tooltip.css('border-left-color');
                    } else {
                        var tooltipBorderWidth = parseFloat(self.$tooltip.css('border-bottom-width')),
                            tooltipBorderColor = self.$tooltip.css('border-bottom-color');
                    }

                    if (tooltipBorderWidth > 1) {
                        tooltipBorderWidth++;
                    }

                    var arrowBorder = '';
                    if (tooltipBorderWidth !== 0) {
                        var arrowBorderSize = '',
                            arrowBorderColor = 'border-color: ' + tooltipBorderColor + ';';
                        if (arrowClass.indexOf('bottom') !== -1) {
                            arrowBorderSize = 'margin-top: -' + Math.round(tooltipBorderWidth) + 'px;';
                        } else if (arrowClass.indexOf('top') !== -1) {
                            arrowBorderSize = 'margin-bottom: -' + Math.round(tooltipBorderWidth) + 'px;';
                        } else if (arrowClass.indexOf('left') !== -1) {
                            arrowBorderSize = 'margin-right: -' + Math.round(tooltipBorderWidth) + 'px;';
                        } else if (arrowClass.indexOf('right') !== -1) {
                            arrowBorderSize = 'margin-left: -' + Math.round(tooltipBorderWidth) + 'px;';
                        }
                        arrowBorder = '<span class="tooltipster-arrow-border" style="' + arrowBorderSize + ' ' + arrowBorderColor + ';"></span>';
                    }

                    // if the arrow already exists, remove and replace it
                    self.$tooltip.find('.tooltipster-arrow').remove();

                    // build out the arrow and append it		
                    var arrowConstruct = '<div class="' + arrowClass + ' tooltipster-arrow" style="' + arrowReposition + '">' + arrowBorder + '<span style="border-color:' + arrowColor + ';"></span></div>';
                    self.$tooltip.append(arrowConstruct);
                }

                // position the tooltip
                self.$tooltip.css({
                    'top': Math.round(myTop) + 'px',
                    'left': Math.round(myLeft) + 'px'
                });
            }

            return self;
        },

        enable: function () {
            this.enabled = true;
            return this;
        },

        disable: function () {
            // hide first, in case the tooltip would not disappear on its own (autoClose false)
            this.hide();
            this.enabled = false;
            return this;
        },

        destroy: function () {

            var self = this;

            self.hide();

            // remove the icon, if any
            if (self.$el[0] !== self.$elProxy[0]) {
                self.$elProxy.remove();
            }

            self.$el.removeData(self.namespace).off('.' + self.namespace);

            var ns = self.$el.data('tooltipster-ns');

            // if there are no more tooltips on this element
            if (ns.length === 1) {

                // optional restoration of a title attribute
                var title = null;
                if (self.options.restoration === 'previous') {
                    title = self.$el.data('tooltipster-initialTitle');
                } else if (self.options.restoration === 'current') {

                    // old school technique to stringify when outerHTML is not supported
                    title = (typeof self.Content === 'string') ? self.Content : $('<div></div>').append(self.Content).html();
                }

                if (title) {
                    self.$el.attr('title', title);
                }

                // final cleaning
                self.$el.removeClass('tooltipstered').removeData('tooltipster-ns').removeData('tooltipster-initialTitle');
            } else {
                // remove the instance namespace from the list of namespaces of tooltips present on the element
                ns = $.grep(ns, function (el, i) {
                    return el !== self.namespace;
                });
                self.$el.data('tooltipster-ns', ns);
            }

            return self;
        },

        elementIcon: function () {
            return (this.$el[0] !== this.$elProxy[0]) ? this.$elProxy[0] : undefined;
        },

        elementTooltip: function () {
            return this.$tooltip ? this.$tooltip[0] : undefined;
        },

        // public methods but for internal use only
        // getter if val is ommitted, setter otherwise
        option: function (o, val) {
            if (typeof val == 'undefined') return this.options[o];
            else {
                this.options[o] = val;
                return this;
            }
        },
        status: function () {
            return this.Status;
        }
    };

    $.fn[pluginName] = function () {

        // for using in closures
        var args = arguments;

        // if we are not in the context of jQuery wrapped HTML element(s) :
        // this happens when calling static methods in the form $.fn.tooltipster('methodName'), or when calling $(sel).tooltipster('methodName or options') where $(sel) does not match anything
        if (this.length === 0) {

            // if the first argument is a method name
            if (typeof args[0] === 'string') {

                var methodIsStatic = true;

                // list static methods here (usable by calling $.fn.tooltipster('methodName');)
                switch (args[0]) {

                    case 'setDefaults':
                        // change default options for all future instances
                        $.extend(defaults, args[1]);
                        break;

                    default:
                        methodIsStatic = false;
                        break;
                }

                // $.fn.tooltipster('methodName') calls will return true
                if (methodIsStatic) return true;
                    // $(sel).tooltipster('methodName') calls will return the list of objects event though it's empty because chaining should work on empty lists
                else
                    return this;
            }
                // the first argument is undefined or an object of options : we are initalizing but there is no element matched by selector
            else {
                // still chainable : same as above
                return this;
            }
        }
            // this happens when calling $(sel).tooltipster('methodName or options') where $(sel) matches one or more elements
        else {

            // method calls
            if (typeof args[0] === 'string') {

                var v = '#*$~&';

                this.each(function () {

                    // retrieve the namepaces of the tooltip(s) that exist on that element. We will interact with the first tooltip only.
                    var ns = $(this).data('tooltipster-ns'),


                        // self represents the instance of the first tooltipster plugin associated to the current HTML object of the loop
                        self = ns ? $(this).data(ns[0]) : null;

                    // if the current element holds a tooltipster instance
                    if (self) {

                        if (typeof self[args[0]] === 'function') {
                            // note : args[1] and args[2] may not be defined
                            var resp = self[args[0]](args[1], args[2]);
                        } else {
                            throw new Error('Unknown method .tooltipster("' + args[0] + '")');
                        }

                        // if the function returned anything other than the instance itself (which implies chaining)
                        if (resp !== self) {
                            v = resp;
                            // return false to stop .each iteration on the first element matched by the selector
                            return false;
                        }
                    } else {
                        throw new Error('You called Tooltipster\'s "' + args[0] + '" method on an uninitialized element');
                    }
                });

                return (v !== '#*$~&') ? v : this;
            }
                // first argument is undefined or an object : the tooltip is initializing
            else {

                var instances = [],


                    // is there a defined value for the multiple option in the options object ?
                    multipleIsSet = args[0] && typeof args[0].multiple !== 'undefined',


                    // if the multiple option is set to true, or if it's not defined but set to true in the defaults
                    multiple = (multipleIsSet && args[0].multiple) || (!multipleIsSet && defaults.multiple),


                    // same for debug
                    debugIsSet = args[0] && typeof args[0].debug !== 'undefined',
                    debug = (debugIsSet && args[0].debug) || (!debugIsSet && defaults.debug);

                // initialize a tooltipster instance for each element if it doesn't already have one or if the multiple option is set, and attach the object to it
                this.each(function () {

                    var go = false,
                        ns = $(this).data('tooltipster-ns'),
                        instance = null;

                    if (!ns) {
                        go = true;
                    } else if (multiple) {
                        go = true;
                    } else if (debug) {
                        console.log('Tooltipster: one or more tooltips are already attached to this element: ignoring. Use the "multiple" option to attach more tooltips.');
                    }

                    if (go) {
                        instance = new Plugin(this, args[0]);

                        // save the reference of the new instance
                        if (!ns) ns = [];
                        ns.push(instance.namespace);
                        $(this).data('tooltipster-ns', ns)

                        // save the instance itself
                        $(this).data(instance.namespace, instance);
                    }

                    instances.push(instance);
                });

                if (multiple) return instances;
                else
                    return this;
            }
        }
    };

    // quick & dirty compare function (not bijective nor multidimensional)


    function areEqual(a, b) {
        var same = true;
        $.each(a, function (i, el) {
            if (typeof b[i] === 'undefined' || a[i] !== b[i]) {
                same = false;
                return false;
            }
        });
        return same;
    }

    // detect if this device can trigger touch events
    var deviceHasTouchCapability = !!('ontouchstart' in window);

    // we'll assume the device has no mouse until we detect any mouse movement
    var deviceHasMouse = false;
    $('body').one('mousemove', function () {
        deviceHasMouse = true;
    });

    function deviceIsPureTouch() {
        return (!deviceHasMouse && deviceHasTouchCapability);
    }

    // detecting support for CSS transitions


    function supportsTransitions() {
        var b = document.body || document.documentElement,
            s = b.style,
            p = 'transition';

        if (typeof s[p] == 'string') {
            return true;
        }

        v = ['Moz', 'Webkit', 'Khtml', 'O', 'ms'], p = p.charAt(0).toUpperCase() + p.substr(1);
        for (var i = 0; i < v.length; i++) {
            if (typeof s[v[i] + p] == 'string') {
                return true;
            }
        }
        return false;
    }
})(jQuery, window, document);;
/*! DataTables 1.10.5
 * ©2008-2015 SpryMedia Ltd - datatables.net/license
 */
(function(Ea,P,k){var O=function(h){function V(a){var b,c,e={};h.each(a,function(d){if((b=d.match(/^([^A-Z]+?)([A-Z])/))&&-1!=="a aa ai ao as b fn i m o s ".indexOf(b[1]+" "))c=d.replace(b[0],b[2].toLowerCase()),e[c]=d,"o"===b[1]&&V(a[d])});a._hungarianMap=e}function H(a,b,c){a._hungarianMap||V(a);var e;h.each(b,function(d){e=a._hungarianMap[d];if(e!==k&&(c||b[e]===k))"o"===e.charAt(0)?(b[e]||(b[e]={}),h.extend(!0,b[e],b[d]),H(a[e],b[e],c)):b[e]=b[d]})}function O(a){var b=o.defaults.oLanguage,c=a.sZeroRecords;
!a.sEmptyTable&&(c&&"No data available in table"===b.sEmptyTable)&&E(a,a,"sZeroRecords","sEmptyTable");!a.sLoadingRecords&&(c&&"Loading..."===b.sLoadingRecords)&&E(a,a,"sZeroRecords","sLoadingRecords");a.sInfoThousands&&(a.sThousands=a.sInfoThousands);(a=a.sDecimal)&&db(a)}function eb(a){A(a,"ordering","bSort");A(a,"orderMulti","bSortMulti");A(a,"orderClasses","bSortClasses");A(a,"orderCellsTop","bSortCellsTop");A(a,"order","aaSorting");A(a,"orderFixed","aaSortingFixed");A(a,"paging","bPaginate");
A(a,"pagingType","sPaginationType");A(a,"pageLength","iDisplayLength");A(a,"searching","bFilter");if(a=a.aoSearchCols)for(var b=0,c=a.length;b<c;b++)a[b]&&H(o.models.oSearch,a[b])}function fb(a){A(a,"orderable","bSortable");A(a,"orderData","aDataSort");A(a,"orderSequence","asSorting");A(a,"orderDataType","sortDataType")}function gb(a){var a=a.oBrowser,b=h("<div/>").css({position:"absolute",top:0,left:0,height:1,width:1,overflow:"hidden"}).append(h("<div/>").css({position:"absolute",top:1,left:1,width:100,
overflow:"scroll"}).append(h('<div class="test"/>').css({width:"100%",height:10}))).appendTo("body"),c=b.find(".test");a.bScrollOversize=100===c[0].offsetWidth;a.bScrollbarLeft=1!==c.offset().left;b.remove()}function hb(a,b,c,e,d,f){var g,j=!1;c!==k&&(g=c,j=!0);for(;e!==d;)a.hasOwnProperty(e)&&(g=j?b(g,a[e],e,a):a[e],j=!0,e+=f);return g}function Fa(a,b){var c=o.defaults.column,e=a.aoColumns.length,c=h.extend({},o.models.oColumn,c,{nTh:b?b:P.createElement("th"),sTitle:c.sTitle?c.sTitle:b?b.innerHTML:
"",aDataSort:c.aDataSort?c.aDataSort:[e],mData:c.mData?c.mData:e,idx:e});a.aoColumns.push(c);c=a.aoPreSearchCols;c[e]=h.extend({},o.models.oSearch,c[e]);ka(a,e,h(b).data())}function ka(a,b,c){var b=a.aoColumns[b],e=a.oClasses,d=h(b.nTh);if(!b.sWidthOrig){b.sWidthOrig=d.attr("width")||null;var f=(d.attr("style")||"").match(/width:\s*(\d+[pxem%]+)/);f&&(b.sWidthOrig=f[1])}c!==k&&null!==c&&(fb(c),H(o.defaults.column,c),c.mDataProp!==k&&!c.mData&&(c.mData=c.mDataProp),c.sType&&(b._sManualType=c.sType),
c.className&&!c.sClass&&(c.sClass=c.className),h.extend(b,c),E(b,c,"sWidth","sWidthOrig"),"number"===typeof c.iDataSort&&(b.aDataSort=[c.iDataSort]),E(b,c,"aDataSort"));var g=b.mData,j=W(g),i=b.mRender?W(b.mRender):null,c=function(a){return"string"===typeof a&&-1!==a.indexOf("@")};b._bAttrSrc=h.isPlainObject(g)&&(c(g.sort)||c(g.type)||c(g.filter));b.fnGetData=function(a,b,c){var e=j(a,b,k,c);return i&&b?i(e,b,a,c):e};b.fnSetData=function(a,b,c){return Q(g)(a,b,c)};"number"!==typeof g&&(a._rowReadObject=
!0);a.oFeatures.bSort||(b.bSortable=!1,d.addClass(e.sSortableNone));a=-1!==h.inArray("asc",b.asSorting);c=-1!==h.inArray("desc",b.asSorting);!b.bSortable||!a&&!c?(b.sSortingClass=e.sSortableNone,b.sSortingClassJUI=""):a&&!c?(b.sSortingClass=e.sSortableAsc,b.sSortingClassJUI=e.sSortJUIAscAllowed):!a&&c?(b.sSortingClass=e.sSortableDesc,b.sSortingClassJUI=e.sSortJUIDescAllowed):(b.sSortingClass=e.sSortable,b.sSortingClassJUI=e.sSortJUI)}function X(a){if(!1!==a.oFeatures.bAutoWidth){var b=a.aoColumns;
Ga(a);for(var c=0,e=b.length;c<e;c++)b[c].nTh.style.width=b[c].sWidth}b=a.oScroll;(""!==b.sY||""!==b.sX)&&Y(a);w(a,null,"column-sizing",[a])}function la(a,b){var c=Z(a,"bVisible");return"number"===typeof c[b]?c[b]:null}function $(a,b){var c=Z(a,"bVisible"),c=h.inArray(b,c);return-1!==c?c:null}function aa(a){return Z(a,"bVisible").length}function Z(a,b){var c=[];h.map(a.aoColumns,function(a,d){a[b]&&c.push(d)});return c}function Ha(a){var b=a.aoColumns,c=a.aoData,e=o.ext.type.detect,d,f,g,j,i,h,l,
p,n;d=0;for(f=b.length;d<f;d++)if(l=b[d],n=[],!l.sType&&l._sManualType)l.sType=l._sManualType;else if(!l.sType){g=0;for(j=e.length;g<j;g++){i=0;for(h=c.length;i<h;i++){n[i]===k&&(n[i]=y(a,i,d,"type"));p=e[g](n[i],a);if(!p&&g!==e.length-1)break;if("html"===p)break}if(p){l.sType=p;break}}l.sType||(l.sType="string")}}function ib(a,b,c,e){var d,f,g,j,i,m,l=a.aoColumns;if(b)for(d=b.length-1;0<=d;d--){m=b[d];var p=m.targets!==k?m.targets:m.aTargets;h.isArray(p)||(p=[p]);f=0;for(g=p.length;f<g;f++)if("number"===
typeof p[f]&&0<=p[f]){for(;l.length<=p[f];)Fa(a);e(p[f],m)}else if("number"===typeof p[f]&&0>p[f])e(l.length+p[f],m);else if("string"===typeof p[f]){j=0;for(i=l.length;j<i;j++)("_all"==p[f]||h(l[j].nTh).hasClass(p[f]))&&e(j,m)}}if(c){d=0;for(a=c.length;d<a;d++)e(d,c[d])}}function J(a,b,c,e){var d=a.aoData.length,f=h.extend(!0,{},o.models.oRow,{src:c?"dom":"data"});f._aData=b;a.aoData.push(f);for(var b=a.aoColumns,f=0,g=b.length;f<g;f++)c&&Ia(a,d,f,y(a,d,f)),b[f].sType=null;a.aiDisplayMaster.push(d);
(c||!a.oFeatures.bDeferRender)&&Ja(a,d,c,e);return d}function ma(a,b){var c;b instanceof h||(b=h(b));return b.map(function(b,d){c=na(a,d);return J(a,c.data,d,c.cells)})}function y(a,b,c,e){var d=a.iDraw,f=a.aoColumns[c],g=a.aoData[b]._aData,j=f.sDefaultContent,c=f.fnGetData(g,e,{settings:a,row:b,col:c});if(c===k)return a.iDrawError!=d&&null===j&&(R(a,0,"Requested unknown parameter "+("function"==typeof f.mData?"{function}":"'"+f.mData+"'")+" for row "+b,4),a.iDrawError=d),j;if((c===g||null===c)&&
null!==j)c=j;else if("function"===typeof c)return c.call(g);return null===c&&"display"==e?"":c}function Ia(a,b,c,e){a.aoColumns[c].fnSetData(a.aoData[b]._aData,e,{settings:a,row:b,col:c})}function Ka(a){return h.map(a.match(/(\\.|[^\.])+/g),function(a){return a.replace(/\\./g,".")})}function W(a){if(h.isPlainObject(a)){var b={};h.each(a,function(a,c){c&&(b[a]=W(c))});return function(a,c,f,g){var j=b[c]||b._;return j!==k?j(a,c,f,g):a}}if(null===a)return function(a){return a};if("function"===typeof a)return function(b,
c,f,g){return a(b,c,f,g)};if("string"===typeof a&&(-1!==a.indexOf(".")||-1!==a.indexOf("[")||-1!==a.indexOf("("))){var c=function(a,b,f){var g,j;if(""!==f){j=Ka(f);for(var i=0,h=j.length;i<h;i++){f=j[i].match(ba);g=j[i].match(S);if(f){j[i]=j[i].replace(ba,"");""!==j[i]&&(a=a[j[i]]);g=[];j.splice(0,i+1);j=j.join(".");i=0;for(h=a.length;i<h;i++)g.push(c(a[i],b,j));a=f[0].substring(1,f[0].length-1);a=""===a?g:g.join(a);break}else if(g){j[i]=j[i].replace(S,"");a=a[j[i]]();continue}if(null===a||a[j[i]]===
k)return k;a=a[j[i]]}}return a};return function(b,d){return c(b,d,a)}}return function(b){return b[a]}}function Q(a){if(h.isPlainObject(a))return Q(a._);if(null===a)return function(){};if("function"===typeof a)return function(b,e,d){a(b,"set",e,d)};if("string"===typeof a&&(-1!==a.indexOf(".")||-1!==a.indexOf("[")||-1!==a.indexOf("("))){var b=function(a,e,d){var d=Ka(d),f;f=d[d.length-1];for(var g,j,i=0,h=d.length-1;i<h;i++){g=d[i].match(ba);j=d[i].match(S);if(g){d[i]=d[i].replace(ba,"");a[d[i]]=[];
f=d.slice();f.splice(0,i+1);g=f.join(".");j=0;for(h=e.length;j<h;j++)f={},b(f,e[j],g),a[d[i]].push(f);return}j&&(d[i]=d[i].replace(S,""),a=a[d[i]](e));if(null===a[d[i]]||a[d[i]]===k)a[d[i]]={};a=a[d[i]]}if(f.match(S))a[f.replace(S,"")](e);else a[f.replace(ba,"")]=e};return function(c,e){return b(c,e,a)}}return function(b,e){b[a]=e}}function La(a){return D(a.aoData,"_aData")}function oa(a){a.aoData.length=0;a.aiDisplayMaster.length=0;a.aiDisplay.length=0}function pa(a,b,c){for(var e=-1,d=0,f=a.length;d<
f;d++)a[d]==b?e=d:a[d]>b&&a[d]--; -1!=e&&c===k&&a.splice(e,1)}function ca(a,b,c,e){var d=a.aoData[b],f,g=function(c,f){for(;c.childNodes.length;)c.removeChild(c.firstChild);c.innerHTML=y(a,b,f,"display")};if("dom"===c||(!c||"auto"===c)&&"dom"===d.src)d._aData=na(a,d,e,e===k?k:d._aData).data;else{var j=d.anCells;if(j)if(e!==k)g(j[e],e);else{c=0;for(f=j.length;c<f;c++)g(j[c],c)}}d._aSortData=null;d._aFilterData=null;g=a.aoColumns;if(e!==k)g[e].sType=null;else{c=0;for(f=g.length;c<f;c++)g[c].sType=null;
Ma(d)}}function na(a,b,c,e){var d=[],f=b.firstChild,g,j=0,i,m=a.aoColumns,l=a._rowReadObject,e=e||l?{}:[],p=function(a,b){if("string"===typeof a){var c=a.indexOf("@");-1!==c&&(c=a.substring(c+1),Q(a)(e,b.getAttribute(c)))}},a=function(a){if(c===k||c===j)g=m[j],i=h.trim(a.innerHTML),g&&g._bAttrSrc?(Q(g.mData._)(e,i),p(g.mData.sort,a),p(g.mData.type,a),p(g.mData.filter,a)):l?(g._setter||(g._setter=Q(g.mData)),g._setter(e,i)):e[j]=i;j++};if(f)for(;f;){b=f.nodeName.toUpperCase();if("TD"==b||"TH"==b)a(f),
d.push(f);f=f.nextSibling}else{d=b.anCells;f=0;for(b=d.length;f<b;f++)a(d[f])}return{data:e,cells:d}}function Ja(a,b,c,e){var d=a.aoData[b],f=d._aData,g=[],j,i,h,l,p;if(null===d.nTr){j=c||P.createElement("tr");d.nTr=j;d.anCells=g;j._DT_RowIndex=b;Ma(d);l=0;for(p=a.aoColumns.length;l<p;l++){h=a.aoColumns[l];i=c?e[l]:P.createElement(h.sCellType);g.push(i);if(!c||h.mRender||h.mData!==l)i.innerHTML=y(a,b,l,"display");h.sClass&&(i.className+=" "+h.sClass);h.bVisible&&!c?j.appendChild(i):!h.bVisible&&c&&
i.parentNode.removeChild(i);h.fnCreatedCell&&h.fnCreatedCell.call(a.oInstance,i,y(a,b,l),f,b,l)}w(a,"aoRowCreatedCallback",null,[j,f,b])}d.nTr.setAttribute("role","row")}function Ma(a){var b=a.nTr,c=a._aData;if(b){c.DT_RowId&&(b.id=c.DT_RowId);if(c.DT_RowClass){var e=c.DT_RowClass.split(" ");a.__rowc=a.__rowc?Na(a.__rowc.concat(e)):e;h(b).removeClass(a.__rowc.join(" ")).addClass(c.DT_RowClass)}c.DT_RowAttr&&h(b).attr(c.DT_RowAttr);c.DT_RowData&&h(b).data(c.DT_RowData)}}function jb(a){var b,c,e,d,
f,g=a.nTHead,j=a.nTFoot,i=0===h("th, td",g).length,m=a.oClasses,l=a.aoColumns;i&&(d=h("<tr/>").appendTo(g));b=0;for(c=l.length;b<c;b++)f=l[b],e=h(f.nTh).addClass(f.sClass),i&&e.appendTo(d),a.oFeatures.bSort&&(e.addClass(f.sSortingClass),!1!==f.bSortable&&(e.attr("tabindex",a.iTabIndex).attr("aria-controls",a.sTableId),Oa(a,f.nTh,b))),f.sTitle!=e.html()&&e.html(f.sTitle),Pa(a,"header")(a,e,f,m);i&&da(a.aoHeader,g);h(g).find(">tr").attr("role","row");h(g).find(">tr>th, >tr>td").addClass(m.sHeaderTH);
h(j).find(">tr>th, >tr>td").addClass(m.sFooterTH);if(null!==j){a=a.aoFooter[0];b=0;for(c=a.length;b<c;b++)f=l[b],f.nTf=a[b].cell,f.sClass&&h(f.nTf).addClass(f.sClass)}}function ea(a,b,c){var e,d,f,g=[],j=[],i=a.aoColumns.length,m;if(b){c===k&&(c=!1);e=0;for(d=b.length;e<d;e++){g[e]=b[e].slice();g[e].nTr=b[e].nTr;for(f=i-1;0<=f;f--)!a.aoColumns[f].bVisible&&!c&&g[e].splice(f,1);j.push([])}e=0;for(d=g.length;e<d;e++){if(a=g[e].nTr)for(;f=a.firstChild;)a.removeChild(f);f=0;for(b=g[e].length;f<b;f++)if(m=
i=1,j[e][f]===k){a.appendChild(g[e][f].cell);for(j[e][f]=1;g[e+i]!==k&&g[e][f].cell==g[e+i][f].cell;)j[e+i][f]=1,i++;for(;g[e][f+m]!==k&&g[e][f].cell==g[e][f+m].cell;){for(c=0;c<i;c++)j[e+c][f+m]=1;m++}h(g[e][f].cell).attr("rowspan",i).attr("colspan",m)}}}}function M(a){var b=w(a,"aoPreDrawCallback","preDraw",[a]);if(-1!==h.inArray(!1,b))C(a,!1);else{var b=[],c=0,e=a.asStripeClasses,d=e.length,f=a.oLanguage,g=a.iInitDisplayStart,j="ssp"==B(a),i=a.aiDisplay;a.bDrawing=!0;g!==k&&-1!==g&&(a._iDisplayStart=
j?g:g>=a.fnRecordsDisplay()?0:g,a.iInitDisplayStart=-1);var g=a._iDisplayStart,m=a.fnDisplayEnd();if(a.bDeferLoading)a.bDeferLoading=!1,a.iDraw++,C(a,!1);else if(j){if(!a.bDestroying&&!kb(a))return}else a.iDraw++;if(0!==i.length){f=j?a.aoData.length:m;for(j=j?0:g;j<f;j++){var l=i[j],p=a.aoData[l];null===p.nTr&&Ja(a,l);l=p.nTr;if(0!==d){var n=e[c%d];p._sRowStripe!=n&&(h(l).removeClass(p._sRowStripe).addClass(n),p._sRowStripe=n)}w(a,"aoRowCallback",null,[l,p._aData,c,j]);b.push(l);c++}}else c=f.sZeroRecords,
1==a.iDraw&&"ajax"==B(a)?c=f.sLoadingRecords:f.sEmptyTable&&0===a.fnRecordsTotal()&&(c=f.sEmptyTable),b[0]=h("<tr/>",{"class":d?e[0]:""}).append(h("<td />",{valign:"top",colSpan:aa(a),"class":a.oClasses.sRowEmpty}).html(c))[0];w(a,"aoHeaderCallback","header",[h(a.nTHead).children("tr")[0],La(a),g,m,i]);w(a,"aoFooterCallback","footer",[h(a.nTFoot).children("tr")[0],La(a),g,m,i]);e=h(a.nTBody);e.children().detach();e.append(h(b));w(a,"aoDrawCallback","draw",[a]);a.bSorted=!1;a.bFiltered=!1;a.bDrawing=
!1}}function N(a,b){var c=a.oFeatures,e=c.bFilter;c.bSort&&lb(a);e?fa(a,a.oPreviousSearch):a.aiDisplay=a.aiDisplayMaster.slice();!0!==b&&(a._iDisplayStart=0);a._drawHold=b;M(a);a._drawHold=!1}function mb(a){var b=a.oClasses,c=h(a.nTable),c=h("<div/>").insertBefore(c),e=a.oFeatures,d=h("<div/>",{id:a.sTableId+"_wrapper","class":b.sWrapper+(a.nTFoot?"":" "+b.sNoFooter)});a.nHolding=c[0];a.nTableWrapper=d[0];a.nTableReinsertBefore=a.nTable.nextSibling;for(var f=a.sDom.split(""),g,j,i,m,l,p,n=0;n<f.length;n++){g=
null;j=f[n];if("<"==j){i=h("<div/>")[0];m=f[n+1];if("'"==m||'"'==m){l="";for(p=2;f[n+p]!=m;)l+=f[n+p],p++;"H"==l?l=b.sJUIHeader:"F"==l&&(l=b.sJUIFooter);-1!=l.indexOf(".")?(m=l.split("."),i.id=m[0].substr(1,m[0].length-1),i.className=m[1]):"#"==l.charAt(0)?i.id=l.substr(1,l.length-1):i.className=l;n+=p}d.append(i);d=h(i)}else if(">"==j)d=d.parent();else if("l"==j&&e.bPaginate&&e.bLengthChange)g=nb(a);else if("f"==j&&e.bFilter)g=ob(a);else if("r"==j&&e.bProcessing)g=pb(a);else if("t"==j)g=qb(a);else if("i"==
j&&e.bInfo)g=rb(a);else if("p"==j&&e.bPaginate)g=sb(a);else if(0!==o.ext.feature.length){i=o.ext.feature;p=0;for(m=i.length;p<m;p++)if(j==i[p].cFeature){g=i[p].fnInit(a);break}}g&&(i=a.aanFeatures,i[j]||(i[j]=[]),i[j].push(g),d.append(g))}c.replaceWith(d)}function da(a,b){var c=h(b).children("tr"),e,d,f,g,j,i,m,l,p,n;a.splice(0,a.length);f=0;for(i=c.length;f<i;f++)a.push([]);f=0;for(i=c.length;f<i;f++){e=c[f];for(d=e.firstChild;d;){if("TD"==d.nodeName.toUpperCase()||"TH"==d.nodeName.toUpperCase()){l=
1*d.getAttribute("colspan");p=1*d.getAttribute("rowspan");l=!l||0===l||1===l?1:l;p=!p||0===p||1===p?1:p;g=0;for(j=a[f];j[g];)g++;m=g;n=1===l?!0:!1;for(j=0;j<l;j++)for(g=0;g<p;g++)a[f+g][m+j]={cell:d,unique:n},a[f+g].nTr=e}d=d.nextSibling}}}function qa(a,b,c){var e=[];c||(c=a.aoHeader,b&&(c=[],da(c,b)));for(var b=0,d=c.length;b<d;b++)for(var f=0,g=c[b].length;f<g;f++)if(c[b][f].unique&&(!e[f]||!a.bSortCellsTop))e[f]=c[b][f].cell;return e}function ra(a,b,c){w(a,"aoServerParams","serverParams",[b]);
if(b&&h.isArray(b)){var e={},d=/(.*?)\[\]$/;h.each(b,function(a,b){var c=b.name.match(d);c?(c=c[0],e[c]||(e[c]=[]),e[c].push(b.value)):e[b.name]=b.value});b=e}var f,g=a.ajax,j=a.oInstance;if(h.isPlainObject(g)&&g.data){f=g.data;var i=h.isFunction(f)?f(b):f,b=h.isFunction(f)&&i?i:h.extend(!0,b,i);delete g.data}i={data:b,success:function(b){var f=b.error||b.sError;f&&a.oApi._fnLog(a,0,f);a.json=b;w(a,null,"xhr",[a,b]);c(b)},dataType:"json",cache:!1,type:a.sServerMethod,error:function(b,c){var f=a.oApi._fnLog;
"parsererror"==c?f(a,0,"Invalid JSON response",1):4===b.readyState&&f(a,0,"Ajax error",7);C(a,!1)}};a.oAjaxData=b;w(a,null,"preXhr",[a,b]);a.fnServerData?a.fnServerData.call(j,a.sAjaxSource,h.map(b,function(a,b){return{name:b,value:a}}),c,a):a.sAjaxSource||"string"===typeof g?a.jqXHR=h.ajax(h.extend(i,{url:g||a.sAjaxSource})):h.isFunction(g)?a.jqXHR=g.call(j,b,c,a):(a.jqXHR=h.ajax(h.extend(i,g)),g.data=f)}function kb(a){return a.bAjaxDataGet?(a.iDraw++,C(a,!0),ra(a,tb(a),function(b){ub(a,b)}),!1):
!0}function tb(a){var b=a.aoColumns,c=b.length,e=a.oFeatures,d=a.oPreviousSearch,f=a.aoPreSearchCols,g,j=[],i,m,l,p=T(a);g=a._iDisplayStart;i=!1!==e.bPaginate?a._iDisplayLength:-1;var n=function(a,b){j.push({name:a,value:b})};n("sEcho",a.iDraw);n("iColumns",c);n("sColumns",D(b,"sName").join(","));n("iDisplayStart",g);n("iDisplayLength",i);var k={draw:a.iDraw,columns:[],order:[],start:g,length:i,search:{value:d.sSearch,regex:d.bRegex}};for(g=0;g<c;g++)m=b[g],l=f[g],i="function"==typeof m.mData?"function":
m.mData,k.columns.push({data:i,name:m.sName,searchable:m.bSearchable,orderable:m.bSortable,search:{value:l.sSearch,regex:l.bRegex}}),n("mDataProp_"+g,i),e.bFilter&&(n("sSearch_"+g,l.sSearch),n("bRegex_"+g,l.bRegex),n("bSearchable_"+g,m.bSearchable)),e.bSort&&n("bSortable_"+g,m.bSortable);e.bFilter&&(n("sSearch",d.sSearch),n("bRegex",d.bRegex));e.bSort&&(h.each(p,function(a,b){k.order.push({column:b.col,dir:b.dir});n("iSortCol_"+a,b.col);n("sSortDir_"+a,b.dir)}),n("iSortingCols",p.length));b=o.ext.legacy.ajax;
return null===b?a.sAjaxSource?j:k:b?j:k}function ub(a,b){var c=b.sEcho!==k?b.sEcho:b.draw,e=b.iTotalRecords!==k?b.iTotalRecords:b.recordsTotal,d=b.iTotalDisplayRecords!==k?b.iTotalDisplayRecords:b.recordsFiltered;if(c){if(1*c<a.iDraw)return;a.iDraw=1*c}oa(a);a._iRecordsTotal=parseInt(e,10);a._iRecordsDisplay=parseInt(d,10);c=sa(a,b);e=0;for(d=c.length;e<d;e++)J(a,c[e]);a.aiDisplay=a.aiDisplayMaster.slice();a.bAjaxDataGet=!1;M(a);a._bInitComplete||ta(a,b);a.bAjaxDataGet=!0;C(a,!1)}function sa(a,b){var c=
h.isPlainObject(a.ajax)&&a.ajax.dataSrc!==k?a.ajax.dataSrc:a.sAjaxDataProp;return"data"===c?b.aaData||b[c]:""!==c?W(c)(b):b}function ob(a){var b=a.oClasses,c=a.sTableId,e=a.oLanguage,d=a.oPreviousSearch,f=a.aanFeatures,g='<input type="search" class="'+b.sFilterInput+'"/>',j=e.sSearch,j=j.match(/_INPUT_/)?j.replace("_INPUT_",g):j+g,b=h("<div/>",{id:!f.f?c+"_filter":null,"class":b.sFilter}).append(h("<label/>").append(j)),f=function(){var b=!this.value?"":this.value;b!=d.sSearch&&(fa(a,{sSearch:b,bRegex:d.bRegex,
bSmart:d.bSmart,bCaseInsensitive:d.bCaseInsensitive}),a._iDisplayStart=0,M(a))},g=null!==a.searchDelay?a.searchDelay:"ssp"===B(a)?400:0,i=h("input",b).val(d.sSearch).attr("placeholder",e.sSearchPlaceholder).bind("keyup.DT search.DT input.DT paste.DT cut.DT",g?ua(f,g):f).bind("keypress.DT",function(a){if(13==a.keyCode)return!1}).attr("aria-controls",c);h(a.nTable).on("search.dt.DT",function(b,c){if(a===c)try{i[0]!==P.activeElement&&i.val(d.sSearch)}catch(f){}});return b[0]}function fa(a,b,c){var e=
a.oPreviousSearch,d=a.aoPreSearchCols,f=function(a){e.sSearch=a.sSearch;e.bRegex=a.bRegex;e.bSmart=a.bSmart;e.bCaseInsensitive=a.bCaseInsensitive};Ha(a);if("ssp"!=B(a)){vb(a,b.sSearch,c,b.bEscapeRegex!==k?!b.bEscapeRegex:b.bRegex,b.bSmart,b.bCaseInsensitive);f(b);for(b=0;b<d.length;b++)wb(a,d[b].sSearch,b,d[b].bEscapeRegex!==k?!d[b].bEscapeRegex:d[b].bRegex,d[b].bSmart,d[b].bCaseInsensitive);xb(a)}else f(b);a.bFiltered=!0;w(a,null,"search",[a])}function xb(a){for(var b=o.ext.search,c=a.aiDisplay,
e,d,f=0,g=b.length;f<g;f++){for(var j=[],i=0,h=c.length;i<h;i++)d=c[i],e=a.aoData[d],b[f](a,e._aFilterData,d,e._aData,i)&&j.push(d);c.length=0;c.push.apply(c,j)}}function wb(a,b,c,e,d,f){if(""!==b)for(var g=a.aiDisplay,e=Qa(b,e,d,f),d=g.length-1;0<=d;d--)b=a.aoData[g[d]]._aFilterData[c],e.test(b)||g.splice(d,1)}function vb(a,b,c,e,d,f){var e=Qa(b,e,d,f),d=a.oPreviousSearch.sSearch,f=a.aiDisplayMaster,g;0!==o.ext.search.length&&(c=!0);g=yb(a);if(0>=b.length)a.aiDisplay=f.slice();else{if(g||c||d.length>
b.length||0!==b.indexOf(d)||a.bSorted)a.aiDisplay=f.slice();b=a.aiDisplay;for(c=b.length-1;0<=c;c--)e.test(a.aoData[b[c]]._sFilterRow)||b.splice(c,1)}}function Qa(a,b,c,e){a=b?a:va(a);c&&(a="^(?=.*?"+h.map(a.match(/"[^"]+"|[^ ]+/g)||"",function(a){if('"'===a.charAt(0))var b=a.match(/^"(.*)"$/),a=b?b[1]:a;return a.replace('"',"")}).join(")(?=.*?")+").*$");return RegExp(a,e?"i":"")}function va(a){return a.replace(Yb,"\\$1")}function yb(a){var b=a.aoColumns,c,e,d,f,g,j,i,h,l=o.ext.type.search;c=!1;e=
0;for(f=a.aoData.length;e<f;e++)if(h=a.aoData[e],!h._aFilterData){j=[];d=0;for(g=b.length;d<g;d++)c=b[d],c.bSearchable?(i=y(a,e,d,"filter"),l[c.sType]&&(i=l[c.sType](i)),null===i&&(i=""),"string"!==typeof i&&i.toString&&(i=i.toString())):i="",i.indexOf&&-1!==i.indexOf("&")&&(wa.innerHTML=i,i=Zb?wa.textContent:wa.innerText),i.replace&&(i=i.replace(/[\r\n]/g,"")),j.push(i);h._aFilterData=j;h._sFilterRow=j.join("  ");c=!0}return c}function zb(a){return{search:a.sSearch,smart:a.bSmart,regex:a.bRegex,
caseInsensitive:a.bCaseInsensitive}}function Ab(a){return{sSearch:a.search,bSmart:a.smart,bRegex:a.regex,bCaseInsensitive:a.caseInsensitive}}function rb(a){var b=a.sTableId,c=a.aanFeatures.i,e=h("<div/>",{"class":a.oClasses.sInfo,id:!c?b+"_info":null});c||(a.aoDrawCallback.push({fn:Bb,sName:"information"}),e.attr("role","status").attr("aria-live","polite"),h(a.nTable).attr("aria-describedby",b+"_info"));return e[0]}function Bb(a){var b=a.aanFeatures.i;if(0!==b.length){var c=a.oLanguage,e=a._iDisplayStart+
1,d=a.fnDisplayEnd(),f=a.fnRecordsTotal(),g=a.fnRecordsDisplay(),j=g?c.sInfo:c.sInfoEmpty;g!==f&&(j+=" "+c.sInfoFiltered);j+=c.sInfoPostFix;j=Cb(a,j);c=c.fnInfoCallback;null!==c&&(j=c.call(a.oInstance,a,e,d,f,g,j));h(b).html(j)}}function Cb(a,b){var c=a.fnFormatNumber,e=a._iDisplayStart+1,d=a._iDisplayLength,f=a.fnRecordsDisplay(),g=-1===d;return b.replace(/_START_/g,c.call(a,e)).replace(/_END_/g,c.call(a,a.fnDisplayEnd())).replace(/_MAX_/g,c.call(a,a.fnRecordsTotal())).replace(/_TOTAL_/g,c.call(a,
f)).replace(/_PAGE_/g,c.call(a,g?1:Math.ceil(e/d))).replace(/_PAGES_/g,c.call(a,g?1:Math.ceil(f/d)))}function ga(a){var b,c,e=a.iInitDisplayStart,d=a.aoColumns,f;c=a.oFeatures;if(a.bInitialised){mb(a);jb(a);ea(a,a.aoHeader);ea(a,a.aoFooter);C(a,!0);c.bAutoWidth&&Ga(a);b=0;for(c=d.length;b<c;b++)f=d[b],f.sWidth&&(f.nTh.style.width=s(f.sWidth));N(a);d=B(a);"ssp"!=d&&("ajax"==d?ra(a,[],function(c){var f=sa(a,c);for(b=0;b<f.length;b++)J(a,f[b]);a.iInitDisplayStart=e;N(a);C(a,!1);ta(a,c)},a):(C(a,!1),
ta(a)))}else setTimeout(function(){ga(a)},200)}function ta(a,b){a._bInitComplete=!0;b&&X(a);w(a,"aoInitComplete","init",[a,b])}function Ra(a,b){var c=parseInt(b,10);a._iDisplayLength=c;Sa(a);w(a,null,"length",[a,c])}function nb(a){for(var b=a.oClasses,c=a.sTableId,e=a.aLengthMenu,d=h.isArray(e[0]),f=d?e[0]:e,e=d?e[1]:e,d=h("<select/>",{name:c+"_length","aria-controls":c,"class":b.sLengthSelect}),g=0,j=f.length;g<j;g++)d[0][g]=new Option(e[g],f[g]);var i=h("<div><label/></div>").addClass(b.sLength);
a.aanFeatures.l||(i[0].id=c+"_length");i.children().append(a.oLanguage.sLengthMenu.replace("_MENU_",d[0].outerHTML));h("select",i).val(a._iDisplayLength).bind("change.DT",function(){Ra(a,h(this).val());M(a)});h(a.nTable).bind("length.dt.DT",function(b,c,f){a===c&&h("select",i).val(f)});return i[0]}function sb(a){var b=a.sPaginationType,c=o.ext.pager[b],e="function"===typeof c,d=function(a){M(a)},b=h("<div/>").addClass(a.oClasses.sPaging+b)[0],f=a.aanFeatures;e||c.fnInit(a,b,d);f.p||(b.id=a.sTableId+
"_paginate",a.aoDrawCallback.push({fn:function(a){if(e){var b=a._iDisplayStart,h=a._iDisplayLength,m=a.fnRecordsDisplay(),l=-1===h,b=l?0:Math.ceil(b/h),h=l?1:Math.ceil(m/h),m=c(b,h),p,l=0;for(p=f.p.length;l<p;l++)Pa(a,"pageButton")(a,f.p[l],l,m,b,h)}else c.fnUpdate(a,d)},sName:"pagination"}));return b}function Ta(a,b,c){var e=a._iDisplayStart,d=a._iDisplayLength,f=a.fnRecordsDisplay();0===f||-1===d?e=0:"number"===typeof b?(e=b*d,e>f&&(e=0)):"first"==b?e=0:"previous"==b?(e=0<=d?e-d:0,0>e&&(e=0)):"next"==
b?e+d<f&&(e+=d):"last"==b?e=Math.floor((f-1)/d)*d:R(a,0,"Unknown paging action: "+b,5);b=a._iDisplayStart!==e;a._iDisplayStart=e;b&&(w(a,null,"page",[a]),c&&M(a));return b}function pb(a){return h("<div/>",{id:!a.aanFeatures.r?a.sTableId+"_processing":null,"class":a.oClasses.sProcessing}).html(a.oLanguage.sProcessing).insertBefore(a.nTable)[0]}function C(a,b){a.oFeatures.bProcessing&&h(a.aanFeatures.r).css("display",b?"block":"none");w(a,null,"processing",[a,b])}function qb(a){var b=h(a.nTable);b.attr("role",
"grid");var c=a.oScroll;if(""===c.sX&&""===c.sY)return a.nTable;var e=c.sX,d=c.sY,f=a.oClasses,g=b.children("caption"),j=g.length?g[0]._captionSide:null,i=h(b[0].cloneNode(!1)),m=h(b[0].cloneNode(!1)),l=b.children("tfoot");c.sX&&"100%"===b.attr("width")&&b.removeAttr("width");l.length||(l=null);c=h("<div/>",{"class":f.sScrollWrapper}).append(h("<div/>",{"class":f.sScrollHead}).css({overflow:"hidden",position:"relative",border:0,width:e?!e?null:s(e):"100%"}).append(h("<div/>",{"class":f.sScrollHeadInner}).css({"box-sizing":"content-box",
width:c.sXInner||"100%"}).append(i.removeAttr("id").css("margin-left",0).append("top"===j?g:null).append(b.children("thead"))))).append(h("<div/>",{"class":f.sScrollBody}).css({overflow:"auto",height:!d?null:s(d),width:!e?null:s(e)}).append(b));l&&c.append(h("<div/>",{"class":f.sScrollFoot}).css({overflow:"hidden",border:0,width:e?!e?null:s(e):"100%"}).append(h("<div/>",{"class":f.sScrollFootInner}).append(m.removeAttr("id").css("margin-left",0).append("bottom"===j?g:null).append(b.children("tfoot")))));
var b=c.children(),p=b[0],f=b[1],n=l?b[2]:null;if(e)h(f).on("scroll.DT",function(){var a=this.scrollLeft;p.scrollLeft=a;l&&(n.scrollLeft=a)});a.nScrollHead=p;a.nScrollBody=f;a.nScrollFoot=n;a.aoDrawCallback.push({fn:Y,sName:"scrolling"});return c[0]}function Y(a){var b=a.oScroll,c=b.sX,e=b.sXInner,d=b.sY,f=b.iBarWidth,g=h(a.nScrollHead),j=g[0].style,i=g.children("div"),m=i[0].style,l=i.children("table"),i=a.nScrollBody,p=h(i),n=i.style,k=h(a.nScrollFoot).children("div"),q=k.children("table"),o=h(a.nTHead),
r=h(a.nTable),t=r[0],u=t.style,K=a.nTFoot?h(a.nTFoot):null,ha=a.oBrowser,w=ha.bScrollOversize,x,v,y,L,z,A=[],B=[],C=[],D,E=function(a){a=a.style;a.paddingTop="0";a.paddingBottom="0";a.borderTopWidth="0";a.borderBottomWidth="0";a.height=0};r.children("thead, tfoot").remove();z=o.clone().prependTo(r);x=o.find("tr");y=z.find("tr");z.find("th, td").removeAttr("tabindex");K&&(L=K.clone().prependTo(r),v=K.find("tr"),L=L.find("tr"));c||(n.width="100%",g[0].style.width="100%");h.each(qa(a,z),function(b,c){D=
la(a,b);c.style.width=a.aoColumns[D].sWidth});K&&G(function(a){a.style.width=""},L);b.bCollapse&&""!==d&&(n.height=p[0].offsetHeight+o[0].offsetHeight+"px");g=r.outerWidth();if(""===c){if(u.width="100%",w&&(r.find("tbody").height()>i.offsetHeight||"scroll"==p.css("overflow-y")))u.width=s(r.outerWidth()-f)}else""!==e?u.width=s(e):g==p.width()&&p.height()<r.height()?(u.width=s(g-f),r.outerWidth()>g-f&&(u.width=s(g))):u.width=s(g);g=r.outerWidth();G(E,y);G(function(a){C.push(a.innerHTML);A.push(s(h(a).css("width")))},
y);G(function(a,b){a.style.width=A[b]},x);h(y).height(0);K&&(G(E,L),G(function(a){B.push(s(h(a).css("width")))},L),G(function(a,b){a.style.width=B[b]},v),h(L).height(0));G(function(a,b){a.innerHTML='<div class="dataTables_sizing" style="height:0;overflow:hidden;">'+C[b]+"</div>";a.style.width=A[b]},y);K&&G(function(a,b){a.innerHTML="";a.style.width=B[b]},L);if(r.outerWidth()<g){v=i.scrollHeight>i.offsetHeight||"scroll"==p.css("overflow-y")?g+f:g;if(w&&(i.scrollHeight>i.offsetHeight||"scroll"==p.css("overflow-y")))u.width=
s(v-f);(""===c||""!==e)&&R(a,1,"Possible column misalignment",6)}else v="100%";n.width=s(v);j.width=s(v);K&&(a.nScrollFoot.style.width=s(v));!d&&w&&(n.height=s(t.offsetHeight+f));d&&b.bCollapse&&(n.height=s(d),b=c&&t.offsetWidth>i.offsetWidth?f:0,t.offsetHeight<i.offsetHeight&&(n.height=s(t.offsetHeight+b)));b=r.outerWidth();l[0].style.width=s(b);m.width=s(b);l=r.height()>i.clientHeight||"scroll"==p.css("overflow-y");ha="padding"+(ha.bScrollbarLeft?"Left":"Right");m[ha]=l?f+"px":"0px";K&&(q[0].style.width=
s(b),k[0].style.width=s(b),k[0].style[ha]=l?f+"px":"0px");p.scroll();if((a.bSorted||a.bFiltered)&&!a._drawHold)i.scrollTop=0}function G(a,b,c){for(var e=0,d=0,f=b.length,g,j;d<f;){g=b[d].firstChild;for(j=c?c[d].firstChild:null;g;)1===g.nodeType&&(c?a(g,j,e):a(g,e),e++),g=g.nextSibling,j=c?j.nextSibling:null;d++}}function Ga(a){var b=a.nTable,c=a.aoColumns,e=a.oScroll,d=e.sY,f=e.sX,g=e.sXInner,j=c.length,e=Z(a,"bVisible"),i=h("th",a.nTHead),m=b.style.width||b.getAttribute("width"),l=b.parentNode,p=
!1,n,k;for(n=0;n<e.length;n++)k=c[e[n]],null!==k.sWidth&&(k.sWidth=Db(k.sWidthOrig,l),p=!0);if(!p&&!f&&!d&&j==aa(a)&&j==i.length)for(n=0;n<j;n++)c[n].sWidth=s(i.eq(n).width());else{j=h(b).clone().empty().css("visibility","hidden").removeAttr("id").append(h(a.nTHead).clone(!1)).append(h(a.nTFoot).clone(!1)).append(h("<tbody><tr/></tbody>"));j.find("tfoot th, tfoot td").css("width","");var q=j.find("tbody tr"),i=qa(a,j.find("thead")[0]);for(n=0;n<e.length;n++)k=c[e[n]],i[n].style.width=null!==k.sWidthOrig&&
""!==k.sWidthOrig?s(k.sWidthOrig):"";if(a.aoData.length)for(n=0;n<e.length;n++)p=e[n],k=c[p],h(Eb(a,p)).clone(!1).append(k.sContentPadding).appendTo(q);j.appendTo(l);f&&g?j.width(g):f?(j.css("width","auto"),j.width()<l.offsetWidth&&j.width(l.offsetWidth)):d?j.width(l.offsetWidth):m&&j.width(m);Fb(a,j[0]);if(f){for(n=g=0;n<e.length;n++)k=c[e[n]],d=h(i[n]).outerWidth(),g+=null===k.sWidthOrig?d:parseInt(k.sWidth,10)+d-h(i[n]).width();j.width(s(g));b.style.width=s(g)}for(n=0;n<e.length;n++)if(k=c[e[n]],
d=h(i[n]).width())k.sWidth=s(d);b.style.width=s(j.css("width"));j.remove()}m&&(b.style.width=s(m));if((m||f)&&!a._reszEvt)h(Ea).bind("resize.DT-"+a.sInstance,ua(function(){X(a)})),a._reszEvt=!0}function ua(a,b){var c=b!==k?b:200,e,d;return function(){var b=this,g=+new Date,j=arguments;e&&g<e+c?(clearTimeout(d),d=setTimeout(function(){e=k;a.apply(b,j)},c)):(e=g,a.apply(b,j))}}function Db(a,b){if(!a)return 0;var c=h("<div/>").css("width",s(a)).appendTo(b||P.body),e=c[0].offsetWidth;c.remove();return e}
function Fb(a,b){var c=a.oScroll;if(c.sX||c.sY)c=!c.sX?c.iBarWidth:0,b.style.width=s(h(b).outerWidth()-c)}function Eb(a,b){var c=Gb(a,b);if(0>c)return null;var e=a.aoData[c];return!e.nTr?h("<td/>").html(y(a,c,b,"display"))[0]:e.anCells[b]}function Gb(a,b){for(var c,e=-1,d=-1,f=0,g=a.aoData.length;f<g;f++)c=y(a,f,b,"display")+"",c=c.replace($b,""),c.length>e&&(e=c.length,d=f);return d}function s(a){return null===a?"0px":"number"==typeof a?0>a?"0px":a+"px":a.match(/\d$/)?a+"px":a}function Hb(){if(!o.__scrollbarWidth){var a=
h("<p/>").css({width:"100%",height:200,padding:0})[0],b=h("<div/>").css({position:"absolute",top:0,left:0,width:200,height:150,padding:0,overflow:"hidden",visibility:"hidden"}).append(a).appendTo("body"),c=a.offsetWidth;b.css("overflow","scroll");a=a.offsetWidth;c===a&&(a=b[0].clientWidth);b.remove();o.__scrollbarWidth=c-a}return o.__scrollbarWidth}function T(a){var b,c,e=[],d=a.aoColumns,f,g,j,i;b=a.aaSortingFixed;c=h.isPlainObject(b);var m=[];f=function(a){a.length&&!h.isArray(a[0])?m.push(a):m.push.apply(m,
a)};h.isArray(b)&&f(b);c&&b.pre&&f(b.pre);f(a.aaSorting);c&&b.post&&f(b.post);for(a=0;a<m.length;a++){i=m[a][0];f=d[i].aDataSort;b=0;for(c=f.length;b<c;b++)g=f[b],j=d[g].sType||"string",m[a]._idx===k&&(m[a]._idx=h.inArray(m[a][1],d[g].asSorting)),e.push({src:i,col:g,dir:m[a][1],index:m[a]._idx,type:j,formatter:o.ext.type.order[j+"-pre"]})}return e}function lb(a){var b,c,e=[],d=o.ext.type.order,f=a.aoData,g=0,j,h=a.aiDisplayMaster,m;Ha(a);m=T(a);b=0;for(c=m.length;b<c;b++)j=m[b],j.formatter&&g++,Ib(a,
j.col);if("ssp"!=B(a)&&0!==m.length){b=0;for(c=h.length;b<c;b++)e[h[b]]=b;g===m.length?h.sort(function(a,b){var c,d,g,h,j=m.length,i=f[a]._aSortData,k=f[b]._aSortData;for(g=0;g<j;g++)if(h=m[g],c=i[h.col],d=k[h.col],c=c<d?-1:c>d?1:0,0!==c)return"asc"===h.dir?c:-c;c=e[a];d=e[b];return c<d?-1:c>d?1:0}):h.sort(function(a,b){var c,g,h,j,i=m.length,k=f[a]._aSortData,o=f[b]._aSortData;for(h=0;h<i;h++)if(j=m[h],c=k[j.col],g=o[j.col],j=d[j.type+"-"+j.dir]||d["string-"+j.dir],c=j(c,g),0!==c)return c;c=e[a];
g=e[b];return c<g?-1:c>g?1:0})}a.bSorted=!0}function Jb(a){for(var b,c,e=a.aoColumns,d=T(a),a=a.oLanguage.oAria,f=0,g=e.length;f<g;f++){c=e[f];var h=c.asSorting;b=c.sTitle.replace(/<.*?>/g,"");var i=c.nTh;i.removeAttribute("aria-sort");c.bSortable&&(0<d.length&&d[0].col==f?(i.setAttribute("aria-sort","asc"==d[0].dir?"ascending":"descending"),c=h[d[0].index+1]||h[0]):c=h[0],b+="asc"===c?a.sSortAscending:a.sSortDescending);i.setAttribute("aria-label",b)}}function Ua(a,b,c,e){var d=a.aaSorting,f=a.aoColumns[b].asSorting,
g=function(a,b){var c=a._idx;c===k&&(c=h.inArray(a[1],f));return c+1<f.length?c+1:b?null:0};"number"===typeof d[0]&&(d=a.aaSorting=[d]);c&&a.oFeatures.bSortMulti?(c=h.inArray(b,D(d,"0")),-1!==c?(b=g(d[c],!0),null===b?d.splice(c,1):(d[c][1]=f[b],d[c]._idx=b)):(d.push([b,f[0],0]),d[d.length-1]._idx=0)):d.length&&d[0][0]==b?(b=g(d[0]),d.length=1,d[0][1]=f[b],d[0]._idx=b):(d.length=0,d.push([b,f[0]]),d[0]._idx=0);N(a);"function"==typeof e&&e(a)}function Oa(a,b,c,e){var d=a.aoColumns[c];Va(b,{},function(b){!1!==
d.bSortable&&(a.oFeatures.bProcessing?(C(a,!0),setTimeout(function(){Ua(a,c,b.shiftKey,e);"ssp"!==B(a)&&C(a,!1)},0)):Ua(a,c,b.shiftKey,e))})}function xa(a){var b=a.aLastSort,c=a.oClasses.sSortColumn,e=T(a),d=a.oFeatures,f,g;if(d.bSort&&d.bSortClasses){d=0;for(f=b.length;d<f;d++)g=b[d].src,h(D(a.aoData,"anCells",g)).removeClass(c+(2>d?d+1:3));d=0;for(f=e.length;d<f;d++)g=e[d].src,h(D(a.aoData,"anCells",g)).addClass(c+(2>d?d+1:3))}a.aLastSort=e}function Ib(a,b){var c=a.aoColumns[b],e=o.ext.order[c.sSortDataType],
d;e&&(d=e.call(a.oInstance,a,b,$(a,b)));for(var f,g=o.ext.type.order[c.sType+"-pre"],h=0,i=a.aoData.length;h<i;h++)if(c=a.aoData[h],c._aSortData||(c._aSortData=[]),!c._aSortData[b]||e)f=e?d[h]:y(a,h,b,"sort"),c._aSortData[b]=g?g(f):f}function ya(a){if(a.oFeatures.bStateSave&&!a.bDestroying){var b={time:+new Date,start:a._iDisplayStart,length:a._iDisplayLength,order:h.extend(!0,[],a.aaSorting),search:zb(a.oPreviousSearch),columns:h.map(a.aoColumns,function(b,e){return{visible:b.bVisible,search:zb(a.aoPreSearchCols[e])}})};
w(a,"aoStateSaveParams","stateSaveParams",[a,b]);a.oSavedState=b;a.fnStateSaveCallback.call(a.oInstance,a,b)}}function Kb(a){var b,c,e=a.aoColumns;if(a.oFeatures.bStateSave){var d=a.fnStateLoadCallback.call(a.oInstance,a);if(d&&d.time&&(b=w(a,"aoStateLoadParams","stateLoadParams",[a,d]),-1===h.inArray(!1,b)&&(b=a.iStateDuration,!(0<b&&d.time<+new Date-1E3*b)&&e.length===d.columns.length))){a.oLoadedState=h.extend(!0,{},d);a._iDisplayStart=d.start;a.iInitDisplayStart=d.start;a._iDisplayLength=d.length;
a.aaSorting=[];h.each(d.order,function(b,c){a.aaSorting.push(c[0]>=e.length?[0,c[1]]:c)});h.extend(a.oPreviousSearch,Ab(d.search));b=0;for(c=d.columns.length;b<c;b++){var f=d.columns[b];e[b].bVisible=f.visible;h.extend(a.aoPreSearchCols[b],Ab(f.search))}w(a,"aoStateLoaded","stateLoaded",[a,d])}}}function za(a){var b=o.settings,a=h.inArray(a,D(b,"nTable"));return-1!==a?b[a]:null}function R(a,b,c,e){c="DataTables warning: "+(null!==a?"table id="+a.sTableId+" - ":"")+c;e&&(c+=". For more information about this error, please see http://datatables.net/tn/"+
e);if(b)Ea.console&&console.log&&console.log(c);else if(b=o.ext,b=b.sErrMode||b.errMode,w(a,null,"error",[a,e,c]),"alert"==b)alert(c);else{if("throw"==b)throw Error(c);"function"==typeof b&&b(a,e,c)}}function E(a,b,c,e){h.isArray(c)?h.each(c,function(c,f){h.isArray(f)?E(a,b,f[0],f[1]):E(a,b,f)}):(e===k&&(e=c),b[c]!==k&&(a[e]=b[c]))}function Lb(a,b,c){var e,d;for(d in b)b.hasOwnProperty(d)&&(e=b[d],h.isPlainObject(e)?(h.isPlainObject(a[d])||(a[d]={}),h.extend(!0,a[d],e)):a[d]=c&&"data"!==d&&"aaData"!==
d&&h.isArray(e)?e.slice():e);return a}function Va(a,b,c){h(a).bind("click.DT",b,function(b){a.blur();c(b)}).bind("keypress.DT",b,function(a){13===a.which&&(a.preventDefault(),c(a))}).bind("selectstart.DT",function(){return!1})}function z(a,b,c,e){c&&a[b].push({fn:c,sName:e})}function w(a,b,c,e){var d=[];b&&(d=h.map(a[b].slice().reverse(),function(b){return b.fn.apply(a.oInstance,e)}));null!==c&&h(a.nTable).trigger(c+".dt",e);return d}function Sa(a){var b=a._iDisplayStart,c=a.fnDisplayEnd(),e=a._iDisplayLength;
b>=c&&(b=c-e);b-=b%e;if(-1===e||0>b)b=0;a._iDisplayStart=b}function Pa(a,b){var c=a.renderer,e=o.ext.renderer[b];return h.isPlainObject(c)&&c[b]?e[c[b]]||e._:"string"===typeof c?e[c]||e._:e._}function B(a){return a.oFeatures.bServerSide?"ssp":a.ajax||a.sAjaxSource?"ajax":"dom"}function Wa(a,b){var c=[],c=Mb.numbers_length,e=Math.floor(c/2);b<=c?c=U(0,b):a<=e?(c=U(0,c-2),c.push("ellipsis"),c.push(b-1)):(a>=b-1-e?c=U(b-(c-2),b):(c=U(a-1,a+2),c.push("ellipsis"),c.push(b-1)),c.splice(0,0,"ellipsis"),
c.splice(0,0,0));c.DT_el="span";return c}function db(a){h.each({num:function(b){return Aa(b,a)},"num-fmt":function(b){return Aa(b,a,Xa)},"html-num":function(b){return Aa(b,a,Ba)},"html-num-fmt":function(b){return Aa(b,a,Ba,Xa)}},function(b,c){x.type.order[b+a+"-pre"]=c;b.match(/^html\-/)&&(x.type.search[b+a]=x.type.search.html)})}function Nb(a){return function(){var b=[za(this[o.ext.iApiIndex])].concat(Array.prototype.slice.call(arguments));return o.ext.internal[a].apply(this,b)}}var o,x,t,r,u,Ya=
{},Ob=/[\r\n]/g,Ba=/<.*?>/g,ac=/^[\w\+\-]/,bc=/[\w\+\-]$/,Yb=RegExp("(\\/|\\.|\\*|\\+|\\?|\\||\\(|\\)|\\[|\\]|\\{|\\}|\\\\|\\$|\\^|\\-)","g"),Xa=/[',$\u00a3\u20ac\u00a5%\u2009\u202F]/g,I=function(a){return!a||!0===a||"-"===a?!0:!1},Pb=function(a){var b=parseInt(a,10);return!isNaN(b)&&isFinite(a)?b:null},Qb=function(a,b){Ya[b]||(Ya[b]=RegExp(va(b),"g"));return"string"===typeof a&&"."!==b?a.replace(/\./g,"").replace(Ya[b],"."):a},Za=function(a,b,c){var e="string"===typeof a;b&&e&&(a=Qb(a,b));c&&e&&
(a=a.replace(Xa,""));return I(a)||!isNaN(parseFloat(a))&&isFinite(a)},Rb=function(a,b,c){return I(a)?!0:!(I(a)||"string"===typeof a)?null:Za(a.replace(Ba,""),b,c)?!0:null},D=function(a,b,c){var e=[],d=0,f=a.length;if(c!==k)for(;d<f;d++)a[d]&&a[d][b]&&e.push(a[d][b][c]);else for(;d<f;d++)a[d]&&e.push(a[d][b]);return e},ia=function(a,b,c,e){var d=[],f=0,g=b.length;if(e!==k)for(;f<g;f++)a[b[f]][c]&&d.push(a[b[f]][c][e]);else for(;f<g;f++)d.push(a[b[f]][c]);return d},U=function(a,b){var c=[],e;b===k?
(b=0,e=a):(e=b,b=a);for(var d=b;d<e;d++)c.push(d);return c},Sb=function(a){for(var b=[],c=0,e=a.length;c<e;c++)a[c]&&b.push(a[c]);return b},Na=function(a){var b=[],c,e,d=a.length,f,g=0;e=0;a:for(;e<d;e++){c=a[e];for(f=0;f<g;f++)if(b[f]===c)continue a;b.push(c);g++}return b},A=function(a,b,c){a[b]!==k&&(a[c]=a[b])},ba=/\[.*?\]$/,S=/\(\)$/,wa=h("<div>")[0],Zb=wa.textContent!==k,$b=/<.*?>/g;o=function(a){this.$=function(a,b){return this.api(!0).$(a,b)};this._=function(a,b){return this.api(!0).rows(a,
b).data()};this.api=function(a){return a?new t(za(this[x.iApiIndex])):new t(this)};this.fnAddData=function(a,b){var c=this.api(!0),e=h.isArray(a)&&(h.isArray(a[0])||h.isPlainObject(a[0]))?c.rows.add(a):c.row.add(a);(b===k||b)&&c.draw();return e.flatten().toArray()};this.fnAdjustColumnSizing=function(a){var b=this.api(!0).columns.adjust(),c=b.settings()[0],e=c.oScroll;a===k||a?b.draw(!1):(""!==e.sX||""!==e.sY)&&Y(c)};this.fnClearTable=function(a){var b=this.api(!0).clear();(a===k||a)&&b.draw()};this.fnClose=
function(a){this.api(!0).row(a).child.hide()};this.fnDeleteRow=function(a,b,c){var e=this.api(!0),a=e.rows(a),d=a.settings()[0],h=d.aoData[a[0][0]];a.remove();b&&b.call(this,d,h);(c===k||c)&&e.draw();return h};this.fnDestroy=function(a){this.api(!0).destroy(a)};this.fnDraw=function(a){this.api(!0).draw(!a)};this.fnFilter=function(a,b,c,e,d,h){d=this.api(!0);null===b||b===k?d.search(a,c,e,h):d.column(b).search(a,c,e,h);d.draw()};this.fnGetData=function(a,b){var c=this.api(!0);if(a!==k){var e=a.nodeName?
a.nodeName.toLowerCase():"";return b!==k||"td"==e||"th"==e?c.cell(a,b).data():c.row(a).data()||null}return c.data().toArray()};this.fnGetNodes=function(a){var b=this.api(!0);return a!==k?b.row(a).node():b.rows().nodes().flatten().toArray()};this.fnGetPosition=function(a){var b=this.api(!0),c=a.nodeName.toUpperCase();return"TR"==c?b.row(a).index():"TD"==c||"TH"==c?(a=b.cell(a).index(),[a.row,a.columnVisible,a.column]):null};this.fnIsOpen=function(a){return this.api(!0).row(a).child.isShown()};this.fnOpen=
function(a,b,c){return this.api(!0).row(a).child(b,c).show().child()[0]};this.fnPageChange=function(a,b){var c=this.api(!0).page(a);(b===k||b)&&c.draw(!1)};this.fnSetColumnVis=function(a,b,c){a=this.api(!0).column(a).visible(b);(c===k||c)&&a.columns.adjust().draw()};this.fnSettings=function(){return za(this[x.iApiIndex])};this.fnSort=function(a){this.api(!0).order(a).draw()};this.fnSortListener=function(a,b,c){this.api(!0).order.listener(a,b,c)};this.fnUpdate=function(a,b,c,e,d){var h=this.api(!0);
c===k||null===c?h.row(b).data(a):h.cell(b,c).data(a);(d===k||d)&&h.columns.adjust();(e===k||e)&&h.draw();return 0};this.fnVersionCheck=x.fnVersionCheck;var b=this,c=a===k,e=this.length;c&&(a={});this.oApi=this.internal=x.internal;for(var d in o.ext.internal)d&&(this[d]=Nb(d));this.each(function(){var d={},d=1<e?Lb(d,a,!0):a,g=0,j,i=this.getAttribute("id"),m=!1,l=o.defaults,p=h(this);if("table"!=this.nodeName.toLowerCase())R(null,0,"Non-table node initialisation ("+this.nodeName+")",2);else{eb(l);
fb(l.column);H(l,l,!0);H(l.column,l.column,!0);H(l,h.extend(d,p.data()));var n=o.settings,g=0;for(j=n.length;g<j;g++){var r=n[g];if(r.nTable==this||r.nTHead.parentNode==this||r.nTFoot&&r.nTFoot.parentNode==this){g=d.bRetrieve!==k?d.bRetrieve:l.bRetrieve;if(c||g)return r.oInstance;if(d.bDestroy!==k?d.bDestroy:l.bDestroy){r.oInstance.fnDestroy();break}else{R(r,0,"Cannot reinitialise DataTable",3);return}}if(r.sTableId==this.id){n.splice(g,1);break}}if(null===i||""===i)this.id=i="DataTables_Table_"+
o.ext._unique++;var q=h.extend(!0,{},o.models.oSettings,{nTable:this,oApi:b.internal,oInit:d,sDestroyWidth:p[0].style.width,sInstance:i,sTableId:i});n.push(q);q.oInstance=1===b.length?b:p.dataTable();eb(d);d.oLanguage&&O(d.oLanguage);d.aLengthMenu&&!d.iDisplayLength&&(d.iDisplayLength=h.isArray(d.aLengthMenu[0])?d.aLengthMenu[0][0]:d.aLengthMenu[0]);d=Lb(h.extend(!0,{},l),d);E(q.oFeatures,d,"bPaginate bLengthChange bFilter bSort bSortMulti bInfo bProcessing bAutoWidth bSortClasses bServerSide bDeferRender".split(" "));
E(q,d,["asStripeClasses","ajax","fnServerData","fnFormatNumber","sServerMethod","aaSorting","aaSortingFixed","aLengthMenu","sPaginationType","sAjaxSource","sAjaxDataProp","iStateDuration","sDom","bSortCellsTop","iTabIndex","fnStateLoadCallback","fnStateSaveCallback","renderer","searchDelay",["iCookieDuration","iStateDuration"],["oSearch","oPreviousSearch"],["aoSearchCols","aoPreSearchCols"],["iDisplayLength","_iDisplayLength"],["bJQueryUI","bJUI"]]);E(q.oScroll,d,[["sScrollX","sX"],["sScrollXInner",
"sXInner"],["sScrollY","sY"],["bScrollCollapse","bCollapse"]]);E(q.oLanguage,d,"fnInfoCallback");z(q,"aoDrawCallback",d.fnDrawCallback,"user");z(q,"aoServerParams",d.fnServerParams,"user");z(q,"aoStateSaveParams",d.fnStateSaveParams,"user");z(q,"aoStateLoadParams",d.fnStateLoadParams,"user");z(q,"aoStateLoaded",d.fnStateLoaded,"user");z(q,"aoRowCallback",d.fnRowCallback,"user");z(q,"aoRowCreatedCallback",d.fnCreatedRow,"user");z(q,"aoHeaderCallback",d.fnHeaderCallback,"user");z(q,"aoFooterCallback",
d.fnFooterCallback,"user");z(q,"aoInitComplete",d.fnInitComplete,"user");z(q,"aoPreDrawCallback",d.fnPreDrawCallback,"user");i=q.oClasses;d.bJQueryUI?(h.extend(i,o.ext.oJUIClasses,d.oClasses),d.sDom===l.sDom&&"lfrtip"===l.sDom&&(q.sDom='<"H"lfr>t<"F"ip>'),q.renderer)?h.isPlainObject(q.renderer)&&!q.renderer.header&&(q.renderer.header="jqueryui"):q.renderer="jqueryui":h.extend(i,o.ext.classes,d.oClasses);p.addClass(i.sTable);if(""!==q.oScroll.sX||""!==q.oScroll.sY)q.oScroll.iBarWidth=Hb();!0===q.oScroll.sX&&
(q.oScroll.sX="100%");q.iInitDisplayStart===k&&(q.iInitDisplayStart=d.iDisplayStart,q._iDisplayStart=d.iDisplayStart);null!==d.iDeferLoading&&(q.bDeferLoading=!0,g=h.isArray(d.iDeferLoading),q._iRecordsDisplay=g?d.iDeferLoading[0]:d.iDeferLoading,q._iRecordsTotal=g?d.iDeferLoading[1]:d.iDeferLoading);var t=q.oLanguage;h.extend(!0,t,d.oLanguage);""!==t.sUrl&&(h.ajax({dataType:"json",url:t.sUrl,success:function(a){O(a);H(l.oLanguage,a);h.extend(true,t,a);ga(q)},error:function(){ga(q)}}),m=!0);null===
d.asStripeClasses&&(q.asStripeClasses=[i.sStripeOdd,i.sStripeEven]);var g=q.asStripeClasses,s=h("tbody tr",this).eq(0);-1!==h.inArray(!0,h.map(g,function(a){return s.hasClass(a)}))&&(h("tbody tr",this).removeClass(g.join(" ")),q.asDestroyStripes=g.slice());n=[];g=this.getElementsByTagName("thead");0!==g.length&&(da(q.aoHeader,g[0]),n=qa(q));if(null===d.aoColumns){r=[];g=0;for(j=n.length;g<j;g++)r.push(null)}else r=d.aoColumns;g=0;for(j=r.length;g<j;g++)Fa(q,n?n[g]:null);ib(q,d.aoColumnDefs,r,function(a,
b){ka(q,a,b)});if(s.length){var u=function(a,b){return a.getAttribute("data-"+b)!==null?b:null};h.each(na(q,s[0]).cells,function(a,b){var c=q.aoColumns[a];if(c.mData===a){var e=u(b,"sort")||u(b,"order"),d=u(b,"filter")||u(b,"search");if(e!==null||d!==null){c.mData={_:a+".display",sort:e!==null?a+".@data-"+e:k,type:e!==null?a+".@data-"+e:k,filter:d!==null?a+".@data-"+d:k};ka(q,a)}}})}var v=q.oFeatures;d.bStateSave&&(v.bStateSave=!0,Kb(q,d),z(q,"aoDrawCallback",ya,"state_save"));if(d.aaSorting===k){n=
q.aaSorting;g=0;for(j=n.length;g<j;g++)n[g][1]=q.aoColumns[g].asSorting[0]}xa(q);v.bSort&&z(q,"aoDrawCallback",function(){if(q.bSorted){var a=T(q),b={};h.each(a,function(a,c){b[c.src]=c.dir});w(q,null,"order",[q,a,b]);Jb(q)}});z(q,"aoDrawCallback",function(){(q.bSorted||B(q)==="ssp"||v.bDeferRender)&&xa(q)},"sc");gb(q);g=p.children("caption").each(function(){this._captionSide=p.css("caption-side")});j=p.children("thead");0===j.length&&(j=h("<thead/>").appendTo(this));q.nTHead=j[0];j=p.children("tbody");
0===j.length&&(j=h("<tbody/>").appendTo(this));q.nTBody=j[0];j=p.children("tfoot");if(0===j.length&&0<g.length&&(""!==q.oScroll.sX||""!==q.oScroll.sY))j=h("<tfoot/>").appendTo(this);0===j.length||0===j.children().length?p.addClass(i.sNoFooter):0<j.length&&(q.nTFoot=j[0],da(q.aoFooter,q.nTFoot));if(d.aaData)for(g=0;g<d.aaData.length;g++)J(q,d.aaData[g]);else(q.bDeferLoading||"dom"==B(q))&&ma(q,h(q.nTBody).children("tr"));q.aiDisplay=q.aiDisplayMaster.slice();q.bInitialised=!0;!1===m&&ga(q)}});b=null;
return this};var Tb=[],v=Array.prototype,cc=function(a){var b,c,e=o.settings,d=h.map(e,function(a){return a.nTable});if(a){if(a.nTable&&a.oApi)return[a];if(a.nodeName&&"table"===a.nodeName.toLowerCase())return b=h.inArray(a,d),-1!==b?[e[b]]:null;if(a&&"function"===typeof a.settings)return a.settings().toArray();"string"===typeof a?c=h(a):a instanceof h&&(c=a)}else return[];if(c)return c.map(function(){b=h.inArray(this,d);return-1!==b?e[b]:null}).toArray()};t=function(a,b){if(!this instanceof t)throw"DT API must be constructed as a new object";
var c=[],e=function(a){(a=cc(a))&&c.push.apply(c,a)};if(h.isArray(a))for(var d=0,f=a.length;d<f;d++)e(a[d]);else e(a);this.context=Na(c);b&&this.push.apply(this,b.toArray?b.toArray():b);this.selector={rows:null,cols:null,opts:null};t.extend(this,this,Tb)};o.Api=t;t.prototype={concat:v.concat,context:[],each:function(a){for(var b=0,c=this.length;b<c;b++)a.call(this,this[b],b,this);return this},eq:function(a){var b=this.context;return b.length>a?new t(b[a],this[a]):null},filter:function(a){var b=[];
if(v.filter)b=v.filter.call(this,a,this);else for(var c=0,e=this.length;c<e;c++)a.call(this,this[c],c,this)&&b.push(this[c]);return new t(this.context,b)},flatten:function(){var a=[];return new t(this.context,a.concat.apply(a,this.toArray()))},join:v.join,indexOf:v.indexOf||function(a,b){for(var c=b||0,e=this.length;c<e;c++)if(this[c]===a)return c;return-1},iterator:function(a,b,c,e){var d=[],f,g,h,i,m,l=this.context,p,n,o=this.selector;"string"===typeof a&&(e=c,c=b,b=a,a=!1);g=0;for(h=l.length;g<
h;g++){var q=new t(l[g]);if("table"===b)f=c.call(q,l[g],g),f!==k&&d.push(f);else if("columns"===b||"rows"===b)f=c.call(q,l[g],this[g],g),f!==k&&d.push(f);else if("column"===b||"column-rows"===b||"row"===b||"cell"===b){n=this[g];"column-rows"===b&&(p=Ca(l[g],o.opts));i=0;for(m=n.length;i<m;i++)f=n[i],f="cell"===b?c.call(q,l[g],f.row,f.column,g,i):c.call(q,l[g],f,g,i,p),f!==k&&d.push(f)}}return d.length||e?(a=new t(l,a?d.concat.apply([],d):d),b=a.selector,b.rows=o.rows,b.cols=o.cols,b.opts=o.opts,a):
this},lastIndexOf:v.lastIndexOf||function(a,b){return this.indexOf.apply(this.toArray.reverse(),arguments)},length:0,map:function(a){var b=[];if(v.map)b=v.map.call(this,a,this);else for(var c=0,e=this.length;c<e;c++)b.push(a.call(this,this[c],c));return new t(this.context,b)},pluck:function(a){return this.map(function(b){return b[a]})},pop:v.pop,push:v.push,reduce:v.reduce||function(a,b){return hb(this,a,b,0,this.length,1)},reduceRight:v.reduceRight||function(a,b){return hb(this,a,b,this.length-1,
-1,-1)},reverse:v.reverse,selector:null,shift:v.shift,sort:v.sort,splice:v.splice,toArray:function(){return v.slice.call(this)},to$:function(){return h(this)},toJQuery:function(){return h(this)},unique:function(){return new t(this.context,Na(this))},unshift:v.unshift};t.extend=function(a,b,c){if(c.length&&b&&(b instanceof t||b.__dt_wrapper)){var e,d,f,g=function(a,b,c){return function(){var e=b.apply(a,arguments);t.extend(e,e,c.methodExt);return e}};e=0;for(d=c.length;e<d;e++)f=c[e],b[f.name]="function"===
typeof f.val?g(a,f.val,f):h.isPlainObject(f.val)?{}:f.val,b[f.name].__dt_wrapper=!0,t.extend(a,b[f.name],f.propExt)}};t.register=r=function(a,b){if(h.isArray(a))for(var c=0,e=a.length;c<e;c++)t.register(a[c],b);else for(var d=a.split("."),f=Tb,g,j,c=0,e=d.length;c<e;c++){g=(j=-1!==d[c].indexOf("()"))?d[c].replace("()",""):d[c];var i;a:{i=0;for(var m=f.length;i<m;i++)if(f[i].name===g){i=f[i];break a}i=null}i||(i={name:g,val:{},methodExt:[],propExt:[]},f.push(i));c===e-1?i.val=b:f=j?i.methodExt:i.propExt}};
t.registerPlural=u=function(a,b,c){t.register(a,c);t.register(b,function(){var a=c.apply(this,arguments);return a===this?this:a instanceof t?a.length?h.isArray(a[0])?new t(a.context,a[0]):a[0]:k:a})};r("tables()",function(a){var b;if(a){b=t;var c=this.context;if("number"===typeof a)a=[c[a]];else var e=h.map(c,function(a){return a.nTable}),a=h(e).filter(a).map(function(){var a=h.inArray(this,e);return c[a]}).toArray();b=new b(a)}else b=this;return b});r("table()",function(a){var a=this.tables(a),b=
a.context;return b.length?new t(b[0]):a});u("tables().nodes()","table().node()",function(){return this.iterator("table",function(a){return a.nTable},1)});u("tables().body()","table().body()",function(){return this.iterator("table",function(a){return a.nTBody},1)});u("tables().header()","table().header()",function(){return this.iterator("table",function(a){return a.nTHead},1)});u("tables().footer()","table().footer()",function(){return this.iterator("table",function(a){return a.nTFoot},1)});u("tables().containers()",
"table().container()",function(){return this.iterator("table",function(a){return a.nTableWrapper},1)});r("draw()",function(a){return this.iterator("table",function(b){N(b,!1===a)})});r("page()",function(a){return a===k?this.page.info().page:this.iterator("table",function(b){Ta(b,a)})});r("page.info()",function(){if(0===this.context.length)return k;var a=this.context[0],b=a._iDisplayStart,c=a._iDisplayLength,e=a.fnRecordsDisplay(),d=-1===c;return{page:d?0:Math.floor(b/c),pages:d?1:Math.ceil(e/c),start:b,
end:a.fnDisplayEnd(),length:c,recordsTotal:a.fnRecordsTotal(),recordsDisplay:e}});r("page.len()",function(a){return a===k?0!==this.context.length?this.context[0]._iDisplayLength:k:this.iterator("table",function(b){Ra(b,a)})});var Ub=function(a,b,c){"ssp"==B(a)?N(a,b):(C(a,!0),ra(a,[],function(c){oa(a);for(var c=sa(a,c),e=0,g=c.length;e<g;e++)J(a,c[e]);N(a,b);C(a,!1)}));if(c){var e=new t(a);e.one("draw",function(){c(e.ajax.json())})}};r("ajax.json()",function(){var a=this.context;if(0<a.length)return a[0].json});
r("ajax.params()",function(){var a=this.context;if(0<a.length)return a[0].oAjaxData});r("ajax.reload()",function(a,b){return this.iterator("table",function(c){Ub(c,!1===b,a)})});r("ajax.url()",function(a){var b=this.context;if(a===k){if(0===b.length)return k;b=b[0];return b.ajax?h.isPlainObject(b.ajax)?b.ajax.url:b.ajax:b.sAjaxSource}return this.iterator("table",function(b){h.isPlainObject(b.ajax)?b.ajax.url=a:b.ajax=a})});r("ajax.url().load()",function(a,b){return this.iterator("table",function(c){Ub(c,
!1===b,a)})});var $a=function(a,b){var c=[],e,d,f,g,j,i;e=typeof a;if(!a||"string"===e||"function"===e||a.length===k)a=[a];f=0;for(g=a.length;f<g;f++){d=a[f]&&a[f].split?a[f].split(","):[a[f]];j=0;for(i=d.length;j<i;j++)(e=b("string"===typeof d[j]?h.trim(d[j]):d[j]))&&e.length&&c.push.apply(c,e)}return c},ab=function(a){a||(a={});a.filter&&!a.search&&(a.search=a.filter);return{search:a.search||"none",order:a.order||"current",page:a.page||"all"}},bb=function(a){for(var b=0,c=a.length;b<c;b++)if(0<
a[b].length)return a[0]=a[b],a.length=1,a.context=[a.context[b]],a;a.length=0;return a},Ca=function(a,b){var c,e,d,f=[],g=a.aiDisplay;c=a.aiDisplayMaster;var j=b.search;e=b.order;d=b.page;if("ssp"==B(a))return"removed"===j?[]:U(0,c.length);if("current"==d){c=a._iDisplayStart;for(e=a.fnDisplayEnd();c<e;c++)f.push(g[c])}else if("current"==e||"applied"==e)f="none"==j?c.slice():"applied"==j?g.slice():h.map(c,function(a){return-1===h.inArray(a,g)?a:null});else if("index"==e||"original"==e){c=0;for(e=a.aoData.length;c<
e;c++)"none"==j?f.push(c):(d=h.inArray(c,g),(-1===d&&"removed"==j||0<=d&&"applied"==j)&&f.push(c))}return f};r("rows()",function(a,b){a===k?a="":h.isPlainObject(a)&&(b=a,a="");var b=ab(b),c=this.iterator("table",function(c){var d=b;return $a(a,function(a){var b=Pb(a);if(b!==null&&!d)return[b];var j=Ca(c,d);if(b!==null&&h.inArray(b,j)!==-1)return[b];if(!a)return j;if(typeof a==="function")return h.map(j,function(b){var d=c.aoData[b];return a(b,d._aData,d.nTr)?b:null});b=Sb(ia(c.aoData,j,"nTr"));return a.nodeName&&
h.inArray(a,b)!==-1?[a._DT_RowIndex]:h(b).filter(a).map(function(){return this._DT_RowIndex}).toArray()})},1);c.selector.rows=a;c.selector.opts=b;return c});r("rows().nodes()",function(){return this.iterator("row",function(a,b){return a.aoData[b].nTr||k},1)});r("rows().data()",function(){return this.iterator(!0,"rows",function(a,b){return ia(a.aoData,b,"_aData")},1)});u("rows().cache()","row().cache()",function(a){return this.iterator("row",function(b,c){var e=b.aoData[c];return"search"===a?e._aFilterData:
e._aSortData},1)});u("rows().invalidate()","row().invalidate()",function(a){return this.iterator("row",function(b,c){ca(b,c,a)})});u("rows().indexes()","row().index()",function(){return this.iterator("row",function(a,b){return b},1)});u("rows().remove()","row().remove()",function(){var a=this;return this.iterator("row",function(b,c,e){var d=b.aoData;d.splice(c,1);for(var f=0,g=d.length;f<g;f++)null!==d[f].nTr&&(d[f].nTr._DT_RowIndex=f);h.inArray(c,b.aiDisplay);pa(b.aiDisplayMaster,c);pa(b.aiDisplay,
c);pa(a[e],c,!1);Sa(b)})});r("rows.add()",function(a){var b=this.iterator("table",function(b){var c,f,g,h=[];f=0;for(g=a.length;f<g;f++)c=a[f],c.nodeName&&"TR"===c.nodeName.toUpperCase()?h.push(ma(b,c)[0]):h.push(J(b,c));return h},1),c=this.rows(-1);c.pop();c.push.apply(c,b.toArray());return c});r("row()",function(a,b){return bb(this.rows(a,b))});r("row().data()",function(a){var b=this.context;if(a===k)return b.length&&this.length?b[0].aoData[this[0]]._aData:k;b[0].aoData[this[0]]._aData=a;ca(b[0],
this[0],"data");return this});r("row().node()",function(){var a=this.context;return a.length&&this.length?a[0].aoData[this[0]].nTr||null:null});r("row.add()",function(a){a instanceof h&&a.length&&(a=a[0]);var b=this.iterator("table",function(b){return a.nodeName&&"TR"===a.nodeName.toUpperCase()?ma(b,a)[0]:J(b,a)});return this.row(b[0])});var cb=function(a,b){var c=a.context;c.length&&(c=c[0].aoData[b!==k?b:a[0]],c._details&&(c._details.remove(),c._detailsShow=k,c._details=k))},Vb=function(a,b){var c=
a.context;if(c.length&&a.length){var e=c[0].aoData[a[0]];if(e._details){(e._detailsShow=b)?e._details.insertAfter(e.nTr):e._details.detach();var d=c[0],f=new t(d),g=d.aoData;f.off("draw.dt.DT_details column-visibility.dt.DT_details destroy.dt.DT_details");0<D(g,"_details").length&&(f.on("draw.dt.DT_details",function(a,b){d===b&&f.rows({page:"current"}).eq(0).each(function(a){a=g[a];a._detailsShow&&a._details.insertAfter(a.nTr)})}),f.on("column-visibility.dt.DT_details",function(a,b){if(d===b)for(var c,
e=aa(b),f=0,h=g.length;f<h;f++)c=g[f],c._details&&c._details.children("td[colspan]").attr("colspan",e)}),f.on("destroy.dt.DT_details",function(a,b){if(d===b)for(var c=0,e=g.length;c<e;c++)g[c]._details&&cb(f,c)}))}}};r("row().child()",function(a,b){var c=this.context;if(a===k)return c.length&&this.length?c[0].aoData[this[0]]._details:k;if(!0===a)this.child.show();else if(!1===a)cb(this);else if(c.length&&this.length){var e=c[0],c=c[0].aoData[this[0]],d=[],f=function(a,b){if(a.nodeName&&"tr"===a.nodeName.toLowerCase())d.push(a);
else{var c=h("<tr><td/></tr>").addClass(b);h("td",c).addClass(b).html(a)[0].colSpan=aa(e);d.push(c[0])}};if(h.isArray(a)||a instanceof h)for(var g=0,j=a.length;g<j;g++)f(a[g],b);else f(a,b);c._details&&c._details.remove();c._details=h(d);c._detailsShow&&c._details.insertAfter(c.nTr)}return this});r(["row().child.show()","row().child().show()"],function(){Vb(this,!0);return this});r(["row().child.hide()","row().child().hide()"],function(){Vb(this,!1);return this});r(["row().child.remove()","row().child().remove()"],
function(){cb(this);return this});r("row().child.isShown()",function(){var a=this.context;return a.length&&this.length?a[0].aoData[this[0]]._detailsShow||!1:!1});var dc=/^(.+):(name|visIdx|visible)$/,Wb=function(a,b,c,e,d){for(var c=[],e=0,f=d.length;e<f;e++)c.push(y(a,d[e],b));return c};r("columns()",function(a,b){a===k?a="":h.isPlainObject(a)&&(b=a,a="");var b=ab(b),c=this.iterator("table",function(c){var d=a,f=b,g=c.aoColumns,j=D(g,"sName"),i=D(g,"nTh");return $a(d,function(a){var b=Pb(a);if(a===
"")return U(g.length);if(b!==null)return[b>=0?b:g.length+b];if(typeof a==="function"){var d=Ca(c,f);return h.map(g,function(b,f){return a(f,Wb(c,f,0,0,d),i[f])?f:null})}var k=typeof a==="string"?a.match(dc):"";if(k)switch(k[2]){case "visIdx":case "visible":b=parseInt(k[1],10);if(b<0){var o=h.map(g,function(a,b){return a.bVisible?b:null});return[o[o.length+b]]}return[la(c,b)];case "name":return h.map(j,function(a,b){return a===k[1]?b:null})}else return h(i).filter(a).map(function(){return h.inArray(this,
i)}).toArray()})},1);c.selector.cols=a;c.selector.opts=b;return c});u("columns().header()","column().header()",function(){return this.iterator("column",function(a,b){return a.aoColumns[b].nTh},1)});u("columns().footer()","column().footer()",function(){return this.iterator("column",function(a,b){return a.aoColumns[b].nTf},1)});u("columns().data()","column().data()",function(){return this.iterator("column-rows",Wb,1)});u("columns().dataSrc()","column().dataSrc()",function(){return this.iterator("column",
function(a,b){return a.aoColumns[b].mData},1)});u("columns().cache()","column().cache()",function(a){return this.iterator("column-rows",function(b,c,e,d,f){return ia(b.aoData,f,"search"===a?"_aFilterData":"_aSortData",c)},1)});u("columns().nodes()","column().nodes()",function(){return this.iterator("column-rows",function(a,b,c,e,d){return ia(a.aoData,d,"anCells",b)},1)});u("columns().visible()","column().visible()",function(a,b){return this.iterator("column",function(c,e){if(a===k)return c.aoColumns[e].bVisible;
var d=c.aoColumns,f=d[e],g=c.aoData,j,i,m;if(a!==k&&f.bVisible!==a){if(a){var l=h.inArray(!0,D(d,"bVisible"),e+1);j=0;for(i=g.length;j<i;j++)m=g[j].nTr,d=g[j].anCells,m&&m.insertBefore(d[e],d[l]||null)}else h(D(c.aoData,"anCells",e)).detach();f.bVisible=a;ea(c,c.aoHeader);ea(c,c.aoFooter);if(b===k||b)X(c),(c.oScroll.sX||c.oScroll.sY)&&Y(c);w(c,null,"column-visibility",[c,e,a]);ya(c)}})});u("columns().indexes()","column().index()",function(a){return this.iterator("column",function(b,c){return"visible"===
a?$(b,c):c},1)});r("columns.adjust()",function(){return this.iterator("table",function(a){X(a)},1)});r("column.index()",function(a,b){if(0!==this.context.length){var c=this.context[0];if("fromVisible"===a||"toData"===a)return la(c,b);if("fromData"===a||"toVisible"===a)return $(c,b)}});r("column()",function(a,b){return bb(this.columns(a,b))});r("cells()",function(a,b,c){h.isPlainObject(a)&&(typeof a.row!==k?(c=b,b=null):(c=a,a=null));h.isPlainObject(b)&&(c=b,b=null);if(null===b||b===k)return this.iterator("table",
function(b){var e=a,d=ab(c),f=b.aoData,g=Ca(b,d),d=Sb(ia(f,g,"anCells")),j=h([].concat.apply([],d)),i,l=b.aoColumns.length,m,o,r,t,s,u;return $a(e,function(a){var c=typeof a==="function";if(a===null||a===k||c){m=[];o=0;for(r=g.length;o<r;o++){i=g[o];for(t=0;t<l;t++){s={row:i,column:t};if(c){u=b.aoData[i];a(s,y(b,i,t),u.anCells[t])&&m.push(s)}else m.push(s)}}return m}return h.isPlainObject(a)?[a]:j.filter(a).map(function(a,b){i=b.parentNode._DT_RowIndex;return{row:i,column:h.inArray(b,f[i].anCells)}}).toArray()})});
var e=this.columns(b,c),d=this.rows(a,c),f,g,j,i,m,l=this.iterator("table",function(a,b){f=[];g=0;for(j=d[b].length;g<j;g++){i=0;for(m=e[b].length;i<m;i++)f.push({row:d[b][g],column:e[b][i]})}return f},1);h.extend(l.selector,{cols:b,rows:a,opts:c});return l});u("cells().nodes()","cell().node()",function(){return this.iterator("cell",function(a,b,c){return(a=a.aoData[b].anCells)?a[c]:k},1)});r("cells().data()",function(){return this.iterator("cell",function(a,b,c){return y(a,b,c)},1)});u("cells().cache()",
"cell().cache()",function(a){a="search"===a?"_aFilterData":"_aSortData";return this.iterator("cell",function(b,c,e){return b.aoData[c][a][e]},1)});u("cells().render()","cell().render()",function(a){return this.iterator("cell",function(b,c,e){return y(b,c,e,a)},1)});u("cells().indexes()","cell().index()",function(){return this.iterator("cell",function(a,b,c){return{row:b,column:c,columnVisible:$(a,c)}},1)});u("cells().invalidate()","cell().invalidate()",function(a){return this.iterator("cell",function(b,
c,e){ca(b,c,a,e)})});r("cell()",function(a,b,c){return bb(this.cells(a,b,c))});r("cell().data()",function(a){var b=this.context,c=this[0];if(a===k)return b.length&&c.length?y(b[0],c[0].row,c[0].column):k;Ia(b[0],c[0].row,c[0].column,a);ca(b[0],c[0].row,"data",c[0].column);return this});r("order()",function(a,b){var c=this.context;if(a===k)return 0!==c.length?c[0].aaSorting:k;"number"===typeof a?a=[[a,b]]:h.isArray(a[0])||(a=Array.prototype.slice.call(arguments));return this.iterator("table",function(b){b.aaSorting=
a.slice()})});r("order.listener()",function(a,b,c){return this.iterator("table",function(e){Oa(e,a,b,c)})});r(["columns().order()","column().order()"],function(a){var b=this;return this.iterator("table",function(c,e){var d=[];h.each(b[e],function(b,c){d.push([c,a])});c.aaSorting=d})});r("search()",function(a,b,c,e){var d=this.context;return a===k?0!==d.length?d[0].oPreviousSearch.sSearch:k:this.iterator("table",function(d){d.oFeatures.bFilter&&fa(d,h.extend({},d.oPreviousSearch,{sSearch:a+"",bRegex:null===
b?!1:b,bSmart:null===c?!0:c,bCaseInsensitive:null===e?!0:e}),1)})});u("columns().search()","column().search()",function(a,b,c,e){return this.iterator("column",function(d,f){var g=d.aoPreSearchCols;if(a===k)return g[f].sSearch;d.oFeatures.bFilter&&(h.extend(g[f],{sSearch:a+"",bRegex:null===b?!1:b,bSmart:null===c?!0:c,bCaseInsensitive:null===e?!0:e}),fa(d,d.oPreviousSearch,1))})});r("state()",function(){return this.context.length?this.context[0].oSavedState:null});r("state.clear()",function(){return this.iterator("table",
function(a){a.fnStateSaveCallback.call(a.oInstance,a,{})})});r("state.loaded()",function(){return this.context.length?this.context[0].oLoadedState:null});r("state.save()",function(){return this.iterator("table",function(a){ya(a)})});o.versionCheck=o.fnVersionCheck=function(a){for(var b=o.version.split("."),a=a.split("."),c,e,d=0,f=a.length;d<f;d++)if(c=parseInt(b[d],10)||0,e=parseInt(a[d],10)||0,c!==e)return c>e;return!0};o.isDataTable=o.fnIsDataTable=function(a){var b=h(a).get(0),c=!1;h.each(o.settings,
function(a,d){if(d.nTable===b||h("table",d.nScrollHead)[0]===b||h("table",d.nScrollFoot)[0]===b)c=!0});return c};o.tables=o.fnTables=function(a){return h.map(o.settings,function(b){if(!a||a&&h(b.nTable).is(":visible"))return b.nTable})};o.util={throttle:ua,escapeRegex:va};o.camelToHungarian=H;r("$()",function(a,b){var c=this.rows(b).nodes(),c=h(c);return h([].concat(c.filter(a).toArray(),c.find(a).toArray()))});h.each(["on","one","off"],function(a,b){r(b+"()",function(){var a=Array.prototype.slice.call(arguments);
a[0].match(/\.dt\b/)||(a[0]+=".dt");var e=h(this.tables().nodes());e[b].apply(e,a);return this})});r("clear()",function(){return this.iterator("table",function(a){oa(a)})});r("settings()",function(){return new t(this.context,this.context)});r("data()",function(){return this.iterator("table",function(a){return D(a.aoData,"_aData")}).flatten()});r("destroy()",function(a){a=a||!1;return this.iterator("table",function(b){var c=b.nTableWrapper.parentNode,e=b.oClasses,d=b.nTable,f=b.nTBody,g=b.nTHead,j=
b.nTFoot,i=h(d),f=h(f),k=h(b.nTableWrapper),l=h.map(b.aoData,function(a){return a.nTr}),p;b.bDestroying=!0;w(b,"aoDestroyCallback","destroy",[b]);a||(new t(b)).columns().visible(!0);k.unbind(".DT").find(":not(tbody *)").unbind(".DT");h(Ea).unbind(".DT-"+b.sInstance);d!=g.parentNode&&(i.children("thead").detach(),i.append(g));j&&d!=j.parentNode&&(i.children("tfoot").detach(),i.append(j));i.detach();k.detach();b.aaSorting=[];b.aaSortingFixed=[];xa(b);h(l).removeClass(b.asStripeClasses.join(" "));h("th, td",
g).removeClass(e.sSortable+" "+e.sSortableAsc+" "+e.sSortableDesc+" "+e.sSortableNone);b.bJUI&&(h("th span."+e.sSortIcon+", td span."+e.sSortIcon,g).detach(),h("th, td",g).each(function(){var a=h("div."+e.sSortJUIWrapper,this);h(this).append(a.contents());a.detach()}));!a&&c&&c.insertBefore(d,b.nTableReinsertBefore);f.children().detach();f.append(l);i.css("width",b.sDestroyWidth).removeClass(e.sTable);(p=b.asDestroyStripes.length)&&f.children().each(function(a){h(this).addClass(b.asDestroyStripes[a%
p])});c=h.inArray(b,o.settings);-1!==c&&o.settings.splice(c,1)})});o.version="1.10.5";o.settings=[];o.models={};o.models.oSearch={bCaseInsensitive:!0,sSearch:"",bRegex:!1,bSmart:!0};o.models.oRow={nTr:null,anCells:null,_aData:[],_aSortData:null,_aFilterData:null,_sFilterRow:null,_sRowStripe:"",src:null};o.models.oColumn={idx:null,aDataSort:null,asSorting:null,bSearchable:null,bSortable:null,bVisible:null,_sManualType:null,_bAttrSrc:!1,fnCreatedCell:null,fnGetData:null,fnSetData:null,mData:null,mRender:null,
nTh:null,nTf:null,sClass:null,sContentPadding:null,sDefaultContent:null,sName:null,sSortDataType:"std",sSortingClass:null,sSortingClassJUI:null,sTitle:null,sType:null,sWidth:null,sWidthOrig:null};o.defaults={aaData:null,aaSorting:[[0,"asc"]],aaSortingFixed:[],ajax:null,aLengthMenu:[10,25,50,100],aoColumns:null,aoColumnDefs:null,aoSearchCols:[],asStripeClasses:null,bAutoWidth:!0,bDeferRender:!1,bDestroy:!1,bFilter:!0,bInfo:!0,bJQueryUI:!1,bLengthChange:!0,bPaginate:!0,bProcessing:!1,bRetrieve:!1,bScrollCollapse:!1,
bServerSide:!1,bSort:!0,bSortMulti:!0,bSortCellsTop:!1,bSortClasses:!0,bStateSave:!1,fnCreatedRow:null,fnDrawCallback:null,fnFooterCallback:null,fnFormatNumber:function(a){return a.toString().replace(/\B(?=(\d{3})+(?!\d))/g,this.oLanguage.sThousands)},fnHeaderCallback:null,fnInfoCallback:null,fnInitComplete:null,fnPreDrawCallback:null,fnRowCallback:null,fnServerData:null,fnServerParams:null,fnStateLoadCallback:function(a){try{return JSON.parse((-1===a.iStateDuration?sessionStorage:localStorage).getItem("DataTables_"+
a.sInstance+"_"+location.pathname))}catch(b){}},fnStateLoadParams:null,fnStateLoaded:null,fnStateSaveCallback:function(a,b){try{(-1===a.iStateDuration?sessionStorage:localStorage).setItem("DataTables_"+a.sInstance+"_"+location.pathname,JSON.stringify(b))}catch(c){}},fnStateSaveParams:null,iStateDuration:7200,iDeferLoading:null,iDisplayLength:10,iDisplayStart:0,iTabIndex:0,oClasses:{},oLanguage:{oAria:{sSortAscending:": activate to sort column ascending",sSortDescending:": activate to sort column descending"},
oPaginate:{sFirst:"First",sLast:"Last",sNext:"Next",sPrevious:"Previous"},sEmptyTable:"No data available in table",sInfo:"Showing _START_ to _END_ of _TOTAL_ entries",sInfoEmpty:"Showing 0 to 0 of 0 entries",sInfoFiltered:"(filtered from _MAX_ total entries)",sInfoPostFix:"",sDecimal:"",sThousands:",",sLengthMenu:"Show _MENU_ entries",sLoadingRecords:"Loading...",sProcessing:"Processing...",sSearch:"Search:",sSearchPlaceholder:"",sUrl:"",sZeroRecords:"No matching records found"},oSearch:h.extend({},
o.models.oSearch),sAjaxDataProp:"data",sAjaxSource:null,sDom:"lfrtip",searchDelay:null,sPaginationType:"simple_numbers",sScrollX:"",sScrollXInner:"",sScrollY:"",sServerMethod:"GET",renderer:null};V(o.defaults);o.defaults.column={aDataSort:null,iDataSort:-1,asSorting:["asc","desc"],bSearchable:!0,bSortable:!0,bVisible:!0,fnCreatedCell:null,mData:null,mRender:null,sCellType:"td",sClass:"",sContentPadding:"",sDefaultContent:null,sName:"",sSortDataType:"std",sTitle:null,sType:null,sWidth:null};V(o.defaults.column);
o.models.oSettings={oFeatures:{bAutoWidth:null,bDeferRender:null,bFilter:null,bInfo:null,bLengthChange:null,bPaginate:null,bProcessing:null,bServerSide:null,bSort:null,bSortMulti:null,bSortClasses:null,bStateSave:null},oScroll:{bCollapse:null,iBarWidth:0,sX:null,sXInner:null,sY:null},oLanguage:{fnInfoCallback:null},oBrowser:{bScrollOversize:!1,bScrollbarLeft:!1},ajax:null,aanFeatures:[],aoData:[],aiDisplay:[],aiDisplayMaster:[],aoColumns:[],aoHeader:[],aoFooter:[],oPreviousSearch:{},aoPreSearchCols:[],
aaSorting:null,aaSortingFixed:[],asStripeClasses:null,asDestroyStripes:[],sDestroyWidth:0,aoRowCallback:[],aoHeaderCallback:[],aoFooterCallback:[],aoDrawCallback:[],aoRowCreatedCallback:[],aoPreDrawCallback:[],aoInitComplete:[],aoStateSaveParams:[],aoStateLoadParams:[],aoStateLoaded:[],sTableId:"",nTable:null,nTHead:null,nTFoot:null,nTBody:null,nTableWrapper:null,bDeferLoading:!1,bInitialised:!1,aoOpenRows:[],sDom:null,searchDelay:null,sPaginationType:"two_button",iStateDuration:0,aoStateSave:[],
aoStateLoad:[],oSavedState:null,oLoadedState:null,sAjaxSource:null,sAjaxDataProp:null,bAjaxDataGet:!0,jqXHR:null,json:k,oAjaxData:k,fnServerData:null,aoServerParams:[],sServerMethod:null,fnFormatNumber:null,aLengthMenu:null,iDraw:0,bDrawing:!1,iDrawError:-1,_iDisplayLength:10,_iDisplayStart:0,_iRecordsTotal:0,_iRecordsDisplay:0,bJUI:null,oClasses:{},bFiltered:!1,bSorted:!1,bSortCellsTop:null,oInit:null,aoDestroyCallback:[],fnRecordsTotal:function(){return"ssp"==B(this)?1*this._iRecordsTotal:this.aiDisplayMaster.length},
fnRecordsDisplay:function(){return"ssp"==B(this)?1*this._iRecordsDisplay:this.aiDisplay.length},fnDisplayEnd:function(){var a=this._iDisplayLength,b=this._iDisplayStart,c=b+a,e=this.aiDisplay.length,d=this.oFeatures,f=d.bPaginate;return d.bServerSide?!1===f||-1===a?b+e:Math.min(b+a,this._iRecordsDisplay):!f||c>e||-1===a?e:c},oInstance:null,sInstance:null,iTabIndex:0,nScrollHead:null,nScrollFoot:null,aLastSort:[],oPlugins:{}};o.ext=x={buttons:{},classes:{},errMode:"alert",feature:[],search:[],internal:{},
legacy:{ajax:null},pager:{},renderer:{pageButton:{},header:{}},order:{},type:{detect:[],search:{},order:{}},_unique:0,fnVersionCheck:o.fnVersionCheck,iApiIndex:0,oJUIClasses:{},sVersion:o.version};h.extend(x,{afnFiltering:x.search,aTypes:x.type.detect,ofnSearch:x.type.search,oSort:x.type.order,afnSortData:x.order,aoFeatures:x.feature,oApi:x.internal,oStdClasses:x.classes,oPagination:x.pager});h.extend(o.ext.classes,{sTable:"dataTable",sNoFooter:"no-footer",sPageButton:"paginate_button",sPageButtonActive:"current",
sPageButtonDisabled:"disabled",sStripeOdd:"odd",sStripeEven:"even",sRowEmpty:"dataTables_empty",sWrapper:"dataTables_wrapper",sFilter:"dataTables_filter",sInfo:"dataTables_info",sPaging:"dataTables_paginate paging_",sLength:"dataTables_length",sProcessing:"dataTables_processing",sSortAsc:"sorting_asc",sSortDesc:"sorting_desc",sSortable:"sorting",sSortableAsc:"sorting_asc_disabled",sSortableDesc:"sorting_desc_disabled",sSortableNone:"sorting_disabled",sSortColumn:"sorting_",sFilterInput:"",sLengthSelect:"",
sScrollWrapper:"dataTables_scroll",sScrollHead:"dataTables_scrollHead",sScrollHeadInner:"dataTables_scrollHeadInner",sScrollBody:"dataTables_scrollBody",sScrollFoot:"dataTables_scrollFoot",sScrollFootInner:"dataTables_scrollFootInner",sHeaderTH:"",sFooterTH:"",sSortJUIAsc:"",sSortJUIDesc:"",sSortJUI:"",sSortJUIAscAllowed:"",sSortJUIDescAllowed:"",sSortJUIWrapper:"",sSortIcon:"",sJUIHeader:"",sJUIFooter:""});var Da="",Da="",F=Da+"ui-state-default",ja=Da+"css_right ui-icon ui-icon-",Xb=Da+"fg-toolbar ui-toolbar ui-widget-header ui-helper-clearfix";
h.extend(o.ext.oJUIClasses,o.ext.classes,{sPageButton:"fg-button ui-button "+F,sPageButtonActive:"ui-state-disabled",sPageButtonDisabled:"ui-state-disabled",sPaging:"dataTables_paginate fg-buttonset ui-buttonset fg-buttonset-multi ui-buttonset-multi paging_",sSortAsc:F+" sorting_asc",sSortDesc:F+" sorting_desc",sSortable:F+" sorting",sSortableAsc:F+" sorting_asc_disabled",sSortableDesc:F+" sorting_desc_disabled",sSortableNone:F+" sorting_disabled",sSortJUIAsc:ja+"triangle-1-n",sSortJUIDesc:ja+"triangle-1-s",
sSortJUI:ja+"carat-2-n-s",sSortJUIAscAllowed:ja+"carat-1-n",sSortJUIDescAllowed:ja+"carat-1-s",sSortJUIWrapper:"DataTables_sort_wrapper",sSortIcon:"DataTables_sort_icon",sScrollHead:"dataTables_scrollHead "+F,sScrollFoot:"dataTables_scrollFoot "+F,sHeaderTH:F,sFooterTH:F,sJUIHeader:Xb+" ui-corner-tl ui-corner-tr",sJUIFooter:Xb+" ui-corner-bl ui-corner-br"});var Mb=o.ext.pager;h.extend(Mb,{simple:function(){return["previous","next"]},full:function(){return["first","previous","next","last"]},simple_numbers:function(a,
b){return["previous",Wa(a,b),"next"]},full_numbers:function(a,b){return["first","previous",Wa(a,b),"next","last"]},_numbers:Wa,numbers_length:7});h.extend(!0,o.ext.renderer,{pageButton:{_:function(a,b,c,e,d,f){var g=a.oClasses,j=a.oLanguage.oPaginate,i,k,l=0,o=function(b,e){var n,r,t,s,u=function(b){Ta(a,b.data.action,true)};n=0;for(r=e.length;n<r;n++){s=e[n];if(h.isArray(s)){t=h("<"+(s.DT_el||"div")+"/>").appendTo(b);o(t,s)}else{k=i="";switch(s){case "ellipsis":b.append("<span>&hellip;</span>");
break;case "first":i=j.sFirst;k=s+(d>0?"":" "+g.sPageButtonDisabled);break;case "previous":i=j.sPrevious;k=s+(d>0?"":" "+g.sPageButtonDisabled);break;case "next":i=j.sNext;k=s+(d<f-1?"":" "+g.sPageButtonDisabled);break;case "last":i=j.sLast;k=s+(d<f-1?"":" "+g.sPageButtonDisabled);break;default:i=s+1;k=d===s?g.sPageButtonActive:""}if(i){t=h("<a>",{"class":g.sPageButton+" "+k,"aria-controls":a.sTableId,"data-dt-idx":l,tabindex:a.iTabIndex,id:c===0&&typeof s==="string"?a.sTableId+"_"+s:null}).html(i).appendTo(b);
Va(t,{action:s},u);l++}}}},n;try{n=h(P.activeElement).data("dt-idx")}catch(r){}o(h(b).empty(),e);n&&h(b).find("[data-dt-idx="+n+"]").focus()}}});h.extend(o.ext.type.detect,[function(a,b){var c=b.oLanguage.sDecimal;return Za(a,c)?"num"+c:null},function(a){if(a&&!(a instanceof Date)&&(!ac.test(a)||!bc.test(a)))return null;var b=Date.parse(a);return null!==b&&!isNaN(b)||I(a)?"date":null},function(a,b){var c=b.oLanguage.sDecimal;return Za(a,c,!0)?"num-fmt"+c:null},function(a,b){var c=b.oLanguage.sDecimal;
return Rb(a,c)?"html-num"+c:null},function(a,b){var c=b.oLanguage.sDecimal;return Rb(a,c,!0)?"html-num-fmt"+c:null},function(a){return I(a)||"string"===typeof a&&-1!==a.indexOf("<")?"html":null}]);h.extend(o.ext.type.search,{html:function(a){return I(a)?a:"string"===typeof a?a.replace(Ob," ").replace(Ba,""):""},string:function(a){return I(a)?a:"string"===typeof a?a.replace(Ob," "):a}});var Aa=function(a,b,c,e){if(0!==a&&(!a||"-"===a))return-Infinity;b&&(a=Qb(a,b));a.replace&&(c&&(a=a.replace(c,"")),
e&&(a=a.replace(e,"")));return 1*a};h.extend(x.type.order,{"date-pre":function(a){return Date.parse(a)||0},"html-pre":function(a){return I(a)?"":a.replace?a.replace(/<.*?>/g,"").toLowerCase():a+""},"string-pre":function(a){return I(a)?"":"string"===typeof a?a.toLowerCase():!a.toString?"":a.toString()},"string-asc":function(a,b){return a<b?-1:a>b?1:0},"string-desc":function(a,b){return a<b?1:a>b?-1:0}});db("");h.extend(!0,o.ext.renderer,{header:{_:function(a,b,c,e){h(a.nTable).on("order.dt.DT",function(d,
f,g,h){if(a===f){d=c.idx;b.removeClass(c.sSortingClass+" "+e.sSortAsc+" "+e.sSortDesc).addClass(h[d]=="asc"?e.sSortAsc:h[d]=="desc"?e.sSortDesc:c.sSortingClass)}})},jqueryui:function(a,b,c,e){h("<div/>").addClass(e.sSortJUIWrapper).append(b.contents()).append(h("<span/>").addClass(e.sSortIcon+" "+c.sSortingClassJUI)).appendTo(b);h(a.nTable).on("order.dt.DT",function(d,f,g,h){if(a===f){d=c.idx;b.removeClass(e.sSortAsc+" "+e.sSortDesc).addClass(h[d]=="asc"?e.sSortAsc:h[d]=="desc"?e.sSortDesc:c.sSortingClass);
b.find("span."+e.sSortIcon).removeClass(e.sSortJUIAsc+" "+e.sSortJUIDesc+" "+e.sSortJUI+" "+e.sSortJUIAscAllowed+" "+e.sSortJUIDescAllowed).addClass(h[d]=="asc"?e.sSortJUIAsc:h[d]=="desc"?e.sSortJUIDesc:c.sSortingClassJUI)}})}}});o.render={number:function(a,b,c,e){return{display:function(d){var f=0>d?"-":"",d=Math.abs(parseFloat(d)),g=parseInt(d,10),d=c?b+(d-g).toFixed(c).substring(2):"";return f+(e||"")+g.toString().replace(/\B(?=(\d{3})+(?!\d))/g,a)+d}}}};h.extend(o.ext.internal,{_fnExternApiFunc:Nb,
_fnBuildAjax:ra,_fnAjaxUpdate:kb,_fnAjaxParameters:tb,_fnAjaxUpdateDraw:ub,_fnAjaxDataSrc:sa,_fnAddColumn:Fa,_fnColumnOptions:ka,_fnAdjustColumnSizing:X,_fnVisibleToColumnIndex:la,_fnColumnIndexToVisible:$,_fnVisbleColumns:aa,_fnGetColumns:Z,_fnColumnTypes:Ha,_fnApplyColumnDefs:ib,_fnHungarianMap:V,_fnCamelToHungarian:H,_fnLanguageCompat:O,_fnBrowserDetect:gb,_fnAddData:J,_fnAddTr:ma,_fnNodeToDataIndex:function(a,b){return b._DT_RowIndex!==k?b._DT_RowIndex:null},_fnNodeToColumnIndex:function(a,b,
c){return h.inArray(c,a.aoData[b].anCells)},_fnGetCellData:y,_fnSetCellData:Ia,_fnSplitObjNotation:Ka,_fnGetObjectDataFn:W,_fnSetObjectDataFn:Q,_fnGetDataMaster:La,_fnClearTable:oa,_fnDeleteIndex:pa,_fnInvalidate:ca,_fnGetRowElements:na,_fnCreateTr:Ja,_fnBuildHead:jb,_fnDrawHead:ea,_fnDraw:M,_fnReDraw:N,_fnAddOptionsHtml:mb,_fnDetectHeader:da,_fnGetUniqueThs:qa,_fnFeatureHtmlFilter:ob,_fnFilterComplete:fa,_fnFilterCustom:xb,_fnFilterColumn:wb,_fnFilter:vb,_fnFilterCreateSearch:Qa,_fnEscapeRegex:va,
_fnFilterData:yb,_fnFeatureHtmlInfo:rb,_fnUpdateInfo:Bb,_fnInfoMacros:Cb,_fnInitialise:ga,_fnInitComplete:ta,_fnLengthChange:Ra,_fnFeatureHtmlLength:nb,_fnFeatureHtmlPaginate:sb,_fnPageChange:Ta,_fnFeatureHtmlProcessing:pb,_fnProcessingDisplay:C,_fnFeatureHtmlTable:qb,_fnScrollDraw:Y,_fnApplyToChildren:G,_fnCalculateColumnWidths:Ga,_fnThrottle:ua,_fnConvertToWidth:Db,_fnScrollingWidthAdjust:Fb,_fnGetWidestNode:Eb,_fnGetMaxLenString:Gb,_fnStringToCss:s,_fnScrollBarWidth:Hb,_fnSortFlatten:T,_fnSort:lb,
_fnSortAria:Jb,_fnSortListener:Ua,_fnSortAttachListener:Oa,_fnSortingClasses:xa,_fnSortData:Ib,_fnSaveState:ya,_fnLoadState:Kb,_fnSettingsFromNode:za,_fnLog:R,_fnMap:E,_fnBindAction:Va,_fnCallbackReg:z,_fnCallbackFire:w,_fnLengthOverflow:Sa,_fnRenderer:Pa,_fnDataSource:B,_fnRowAttributes:Ma,_fnCalculateEnd:function(){}});h.fn.dataTable=o;h.fn.dataTableSettings=o.settings;h.fn.dataTableExt=o.ext;h.fn.DataTable=function(a){return h(this).dataTable(a).api()};h.each(o,function(a,b){h.fn.DataTable[a]=
b});return h.fn.dataTable};"function"===typeof define&&define.amd?define("datatables",["jquery"],O):"object"===typeof exports?module.exports=O(require("jquery")):jQuery&&!jQuery.fn.dataTable&&O(jQuery)})(window,document);
;
(function (win, doc, $) {
    "use strict";

    var mo = {
        version: '0.3.0',
        debug: false,

        // list of all registered module types
        modules: {},

        init: function () {
            mo.detectNewModules();
            mo.loadModules();
        },

        detectNewModules: function () {
            mo.utils.registerDomChangeEvents();

            $(document).on('domChanged', function (e, element) {
                mo.loadModules(element);
            });
        },

        module: function (moduleName, moduleObj) {
            var obj = {};
            obj[moduleName] = moduleObj;
            $.extend(mo.modules, obj);
            return moduleObj;
        },

        loadModules: function (container) {
            if (!container) {
                container = document;
            }

            mo.debug && console.group("init modules inside", container);

            $('[data-module]', container).each(function () {
                var moduleElement = $(this),
                    moduleNames = moduleElement.attr('data-module').split(' ');

                var _this = this;
                moduleNames.forEach(function(moduleName) {
                    var initEvent = null;

                    if (moduleName.indexOf(':') > -1) {
                        var parts = moduleName.split(':');
                        moduleName = parts[0];
                        initEvent = parts[1];
                    }

                    var module = mo.modules[moduleName],
                        settingsAttr = moduleElement.attr('data-' + moduleName),
                        settings = mo.utils.parseSettings(settingsAttr);

                    mo.loadModule(moduleName, _this, module, settings, initEvent);
                });
            });

            mo.debug && console.groupEnd();
        },

        loadModule: function (moduleName, moduleElement, moduleObj, settings, initEvent) {
            if (typeof (settings) === "string") throw new Error('Settings attribute for module "' + moduleName + '" should be JSON-formated: data-' + moduleName + '=\'{ "property": "value" }\'. Current value ("' + settings + '") is not JSON.');

            var $moduleElement = $(moduleElement);

            // skip if this module has no name or has already been initialized on this element
            if (!moduleName || $moduleElement.prop('_mo_' + moduleName)) {
                return;
            }

            if (moduleObj && moduleObj.init) {
                mo.debug && console.debug('module "' + moduleName + '" initialized for ', moduleElement);

                if ('defaults' in moduleObj) {
                    settings = $.extend({}, moduleObj.defaults, settings);
                }

                var moduleState = {
                    name: moduleName,
                    element: moduleElement,
                    $element: $moduleElement,
                    settings: settings || {},
                    obj: moduleObj
                };

                if ('listen' in moduleObj) {
                    $(moduleElement === doc.body ? doc : moduleElement).on(moduleObj.listen, moduleState);
                }

                // set the state before calling init to prevent stack overflow if init moves the $element.
                $moduleElement.prop('_mo_' + moduleName, moduleState);

                // wait for initEvent to trigger instead of running init() immediately
                if (initEvent) {
                    $moduleElement.one(initEvent, function () {
                        moduleObj.init.call(moduleElement, moduleState);
                    });
                } else {
                    moduleObj.init.call(moduleElement, moduleState);
                }
            } else {
                mo.debug && console.warn('module "' + moduleName + '" does not exist, or does not have an init method.');
            }
        },

        event: function (func) {
            return function (event) {
                if (!(event instanceof jQuery.Event) || !event.data) {
                    var context = this;

                    // parameter is moduleState object
                    if ('element' in event) {
                        context = event.element;
                    }

                    func.apply(context, arguments);
                    return;
                }

                var moduleState = event.data,
                    args = [].slice.call(arguments),
                    params = [moduleState].concat(args);

                func.apply(moduleState.element, params);
            };
        }
    };

    mo.utils = (function () {
        return {
            getModule: function (moduleElement, moduleName) {
                return $(moduleElement).prop('_mo_' + moduleName);
            },

            getSettings: function (moduleElement, moduleName) {
                var module = mo.utils.getModule(moduleElement, moduleName);
                return module.settings;
            },

            addModuleToElement: function (moduleElement, moduleName, settings, loadAfter) {
                if (typeof settings === "boolean") {
                    loadAfter = settings;
                    settings = null;
                }

                loadAfter = loadAfter === undefined ? true : loadAfter;

                var $element = $(moduleElement),
                    modules = $element.attr('data-module');

                if (modules) {
                    // module is already there
                    if (modules.indexOf(moduleName) !== -1) return;

                    $element.attr('data-module', modules + ' ' + moduleName);
                } else {
                    $element.attr('data-module', moduleName);
                }

                if (settings) {
                    var attrModuleName = mo.utils.toHyphenCase(moduleName);
                    $element.attr('data-' + attrModuleName, JSON.stringify(settings));
                }

                if (loadAfter) {
                    mo.loadModules($element.parent());
                }
            },

            removeModuleFromElement: function (moduleElement, moduleName) {
                var module = mo.utils.getModule(moduleElement, moduleName);

                if (!module) return;

                // let module clean up event listeners
                if ('destroy' in module.obj && $.isFunction(module.obj.destroy)) {
                    module.obj.destroy(module);
                }

                // remove any event listeners from listen object
                if ('listen' in module.obj) {
                    $(moduleElement === doc.body ? doc : moduleElement).off(module.obj.listen);
                }

                // remove module prop
                module.$element.removeProp('_mo_' + moduleName);

                // remove settings attribute if found
                module.$element.removeAttr('data-' + mo.utils.toHyphenCase(moduleName));
                module.$element.removeData(moduleName);

                // remove module name from data-module attribute
                var modules = module.$element.attr('data-module');
                module.$element.attr('data-module', modules.replace(moduleName, ''));
            },

            toHyphenCase: function (camelCaseString) {
                return camelCaseString.replace(/([A-Z])/g, function (letter) {
                    return '-' + letter.toLowerCase();
                });
            },

            settingsPropertyRegex: /([\w\-$]+):(?:|\s|\d|false|true|null|undefined|\{|\[|\"|\')/gi,
            settingsQuoteRegex: /'/g,

            parseSettings: function (value) {
                if (!value) {
                    return null;
                }

                if (value[0] === '{') { // is using JSON syntax
                    return jQuery.parseJSON(value);
                }

                value = value.replace(mo.utils.settingsPropertyRegex, '\"$1\":') // wrap all property names with quotes
                .replace(mo.utils.settingsQuoteRegex, '\"'); // replace single-quote character with double quotes
                return jQuery.parseJSON('{' + value + '}');
            },

            registerDomChangeEvents: function () {
                // jquery.domchanged.js: https://github.com/jproulx/jquery-domchanged-plugin/blob/master/jquery.domchanged.js

                function jQueryDOMChanged(element, type) {
                    return $(element).trigger('domChanged', [element, type]);
                }

                function jQueryHook(method, caller) {
                    var definition = $.fn[method];
                    if (definition) {
                        $.fn[method] = function () {
                            var args = Array.prototype.slice.apply(arguments);
                            var result = definition.apply(this, args);
                            caller.apply(this, args);
                            return result;
                        };
                    }
                }
                jQueryHook('prepend', function () {
                    return jQueryDOMChanged(this, 'prepend');
                });
                jQueryHook('append', function () {
                    return jQueryDOMChanged(this, 'append');
                });
                jQueryHook('before', function () {
                    return jQueryDOMChanged($(this).parent(), 'before');
                });
                jQueryHook('after', function () {
                    return jQueryDOMChanged($(this).parent(), 'after');
                });
                jQueryHook('html', function (value) {
                    // Internally jQuery will set strings using innerHTML
                    // otherwise will use append to insert new elements
                    // Only trigger on string types to avoid doubled events
                    if (typeof value === 'string') {
                        return jQueryDOMChanged(this, 'html');
                    }
                });
            },

            loadedScripts: {},
            // container for scripts that have been added to the document
            loadScript: function loadScript(url, condition) {
                var dfd = $.Deferred();

                // "condition()" returns true if the necessary objects are loaded.
                if (condition && condition()) {
                    dfd.resolve();
                    return dfd;
                }

                var originalUrl = url;

                if (mo.utils.loadedScripts[originalUrl]) {
                    return mo.utils.loadedScripts[originalUrl];
                }

                var script = document.createElement('script');
                script.type = 'text/javascript';

                // script will call a callback when it's loaded and ready.
                if (url.indexOf('{callback}') > -1) {
                    var callbackName = 'callback' + Math.random().toString().replace('.', '');
                    url = url.replace('{callback}', callbackName);

                    window[callbackName] = function () {
                        dfd.resolve();

                        try {
                            delete window[callbackName];
                        } catch (e) {
                            window[callbackName] = undefined; // IE8 doesn't support "delete"
                        }
                    };
                } else {
                    if (script.readyState) { // IE
                        script.onreadystatechange = function () {
                            if (script.readyState === 'loaded' || script.readyState === 'complete') {
                                script.onreadystatechange = null;
                                dfd.resolve();
                            }
                        };
                    } else { // Others
                        script.onload = function () {
                            dfd.resolve();
                        };
                    }
                }

                mo.utils.loadedScripts[originalUrl] = dfd;
                script.src = url;
                document.body.appendChild(script);

                return dfd.promise();
            }
        };
    })();

    // run mo.init at dom load
    $(mo.init);

    win.mo = mo;
    win.moduler = mo.module;

})(window, document, jQuery);;
/** ==========================================================
 
 * jquery lightSlider.js v1.1.1
 * http://sachinchoolur.github.io/lightslider/
 * Released under the MIT License - http://opensource.org/licenses/mit-license.html  ---- FREE ----
 
 =========================================================/**/
;
(function ($, undefined) {
    "use strict";
    var defaults = {
        item: 3,
        autoWidth: false,
        slideMove: 1,
        slideMargin: 10,
        addClass: '',
        mode: "slide",
        useCSS: true,
        cssEasing: 'ease',
        //'cubic-bezier(0.25, 0, 0.25, 1)',//
        easing: 'linear',
        //'for jquery animation',//
        speed: 400,
        //ms'
        auto: false,
        loop: false,
        slideEndAnimatoin: true,
        pause: 2000,
        keyPress: false,
        controls: true,
        prevHtml: '',
        nextHtml: '',
        rtl: false,
        adaptiveHeight: false,
        vertical: false,
        verticalHeight: 500,
        vThumbWidth: 100,
        thumbItem: 10,
        pager: true,
        gallery: false,
        galleryMargin: 5,
        thumbMargin: 5,
        currentPagerPosition: 'middle',
        enableTouch: true,
        enableDrag: true,
        freeMove: true,
        swipeThreshold: 40,
        responsive: [],
        onBeforeStart: function ($el) { },
        onSliderLoad: function ($el) { },
        onBeforeSlide: function ($el, scene) { },
        onAfterSlide: function ($el, scene) { },
        onBeforeNextSlide: function ($el, scene) { },
        onBeforePrevSlide: function ($el, scene) { }
    };
    $.fn.lightSlider = function (options) {
        if (this.length === 0) {
            return this;
        }

        if (this.length > 1) {
            this.each(function () {
                $(this).lightSlider(options);
            });
            return this;
        }

        var plugin = {},
            settings = $.extend(true, {}, defaults, options),
            settingsTemp = {},
            $el = this;
        plugin.$el = this;

        if (settings.mode === 'fade') {
            settings.vertical = false;
        }
        var $children = $el.children(),
            windowW = $(window).width(),
            breakpoint = null,
            resposiveObj = null,
            length = 0,
            w = 0,
            on = false,
            elSize = 0,
            $slide = '',
            scene = 0,
            property = (settings.vertical === true) ? "height" : "width",
            gutter = (settings.vertical === true) ? "margin-bottom" : "margin-right",
            slideValue = 0,
            pagerWidth = 0,
            slideWidth = 0,
            thumbWidth = 0,
            interval = null,
            isTouch = ('ontouchstart' in document.documentElement);
        var refresh = new Object();

        refresh.chbreakpoint = function () {
            windowW = $(window).width();
            if (settings.responsive.length) {
                if (settings.autoWidth === false) {
                    var item = settings.item;
                }
                if (windowW < settings.responsive[0].breakpoint) {
                    for (var i = 0; i < settings.responsive.length; i++) {
                        if (windowW < settings.responsive[i].breakpoint) {
                            breakpoint = settings.responsive[i].breakpoint;
                            resposiveObj = settings.responsive[i];
                        }
                    }
                }
                if (typeof resposiveObj !== "undefined" && resposiveObj != null) {
                    for (i in resposiveObj.settings) {
                        if (typeof settingsTemp[i] == "undefined" || settingsTemp[i] == null) {
                            settingsTemp[i] = settings[i];
                        }
                        settings[i] = resposiveObj.settings[i];
                    }
                }
                if (!$.isEmptyObject(settingsTemp) && windowW > settings.responsive[0].breakpoint) {
                    for (i in settingsTemp) {
                        settings[i] = settingsTemp[i];
                    }
                }
                if (settings.autoWidth === false) {
                    if (slideValue > 0 && slideWidth > 0) {
                        if (item !== settings.item) {
                            scene = Math.round(slideValue / ((slideWidth + settings.slideMargin) * settings.slideMove));
                        }
                    }
                }
            }
        };

        refresh.calSW = function () {
            if (settings.autoWidth === false) {
                slideWidth = (elSize - ((settings.item * (settings.slideMargin)) - settings.slideMargin)) / settings.item;
            }
        };

        refresh.calWidth = function (cln) {
            var ln = cln === true ? $slide.find('.lslide').length : $children.length;
            if (settings.autoWidth === false) {
                w = ln * (slideWidth + settings.slideMargin);
            } else {
                w = 0;
                for (var i = 0; i < ln; i++) {
                    w += (parseInt($children.eq(i).width()) + settings.slideMargin);
                }
            }
            if (w % 1 !== 0) {
                w = w + 1;
            }
            return w;
        };
        plugin = {
            doCss: function () {
                var support = function () {
                    var transition = ['transition', 'MozTransition', 'WebkitTransition', 'OTransition', 'msTransition', 'KhtmlTransition'];
                    var root = document.documentElement;
                    for (var i = 0; i < transition.length; i++) {
                        if (transition[i] in root.style) {
                            return true;
                        }
                    }
                };
                if (settings.useCSS && support()) {
                    return true;
                }
                return false;
            },
            keyPress: function () {
                if (settings.keyPress) {
                    $(document).on('keyup.lightslider', function (e) {
                        e.preventDefault();
                        if (e.keyCode === 37) {
                            $el.goToPrevSlide();
                            clearInterval(interval);
                        } else if (e.keyCode === 39) {
                            $el.goToNextSlide();
                            clearInterval(interval);
                        }
                    });
                }
            },
            controls: function () {
                if (settings.controls) {
                    $el.after('<div class="lSAction"><a class="lSPrev">' + settings.prevHtml + '</a><a class="lSNext">' + settings.nextHtml + '</a></div>');
                    if (!settings.autoWidth) {
                        if (length <= settings.item) {
                            $slide.find('.lSAction').hide();
                        }
                    } else {
                        if (refresh.calWidth(false) < elSize) {
                            $slide.find('.lSAction').hide();
                        }
                    }
                    $slide.find('.lSAction a').on('click', function (e) {
                        e.preventDefault();
                        if ($(this).attr('class') === 'lSPrev') {
                            $el.goToPrevSlide();
                        } else {
                            $el.goToNextSlide();
                        }
                        clearInterval(interval);
                        return false;
                    });
                }
            },
            initialStyle: function () {
                var $this = this;
                if (settings.mode === 'fade') {
                    settings.autoWidth = false;
                    settings.slideEndAnimatoin = false;
                }
                if (settings.auto) {
                    settings.slideEndAnimatoin = false;
                };
                if (settings.autoWidth) {
                    settings.slideMove = 1;
                    settings.item = 1;
                }
                if (settings.loop) {
                    settings.slideMove = 1;
                    settings.freeMove = false;
                }
                settings.onBeforeStart.call(this, $el);
                refresh.chbreakpoint();
                $el.addClass('lightSlider').wrap("<div class='lSSlideOuter " + settings.addClass + "'><div class='lSSlideWrapper'></div></div>");
                $slide = $el.parent('.lSSlideWrapper');
                if (settings.rtl === true) {
                    $slide.parent().addClass('lSrtl');
                }
                if (settings.vertical) {
                    $slide.parent().addClass('vertical');
                    elSize = settings.verticalHeight;
                    $slide.css('height', elSize + 'px');
                } else {
                    elSize = $el.outerWidth();
                }
                $children.addClass('lslide');
                if (settings.loop === true && settings.mode === 'slide') {
                    refresh.calSW();
                    refresh.clone = function () {
                        if (refresh.calWidth(true) > elSize) { /**/
                            var tWr = 0,
                                tI = 0;
                            for (var k = 0; k < $children.length; k++) {
                                tWr += (parseInt($el.find('.lslide').eq(k).width()) + settings.slideMargin);
                                tI++;
                                if (tWr >= (elSize + settings.slideMargin)) {
                                    break;
                                }
                            }
                            var tItem = settings.autoWidth === true ? tI : settings.item;

                            /**/
                            if (tItem < $el.find('.clone.left').length) {
                                for (var i = 0; i < $el.find('.clone.left').length - tItem; i++) {
                                    $children.eq(i).remove();
                                }
                            }
                            if (tItem < $el.find('.clone.right').length) {
                                for (var j = $children.length - 1; j > ($children.length - 1 - $el.find('.clone.right').length) ; j--) {
                                    scene--;
                                    $children.eq(j).remove();
                                }
                            } /**/
                            for (var k = $el.find('.clone.right').length; k < tItem; k++) {
                                $el.find('.lslide').eq(k).clone().removeClass('lslide').addClass('clone right').appendTo($el);
                                scene++;
                            }
                            for (var m = $el.find('.lslide').length - $el.find('.clone.left').length; m > ($el.find('.lslide').length - tItem) ; m--) {
                                $el.find('.lslide').eq(m - 1).clone().removeClass('lslide').addClass('clone left').prependTo($el);
                            }
                            $children = $el.children();
                        } else {
                            if ($children.hasClass('clone')) {
                                $el.find('.clone').remove();
                                $this.move($el, 0);
                            }
                        }
                    };
                    refresh.clone();
                }
                refresh.sSW = function () {
                    length = $children.length;
                    if (settings.rtl === true && settings.vertical === false) {
                        gutter = "margin-left";
                    }
                    if (settings.autoWidth === false) {
                        $children.css(property, slideWidth + 'px');
                    }
                    $children.css(gutter, settings.slideMargin + 'px');
                    w = refresh.calWidth(false);
                    $el.css(property, w + 'px');
                    if (settings.loop === true && settings.mode === 'slide') {
                        if (on === false) {
                            scene = $el.find('.clone.left').length;
                        }
                    }
                };
                refresh.calL = function () {
                    $children = $el.children();
                    length = $children.length;
                };
                if (this.doCss()) {
                    $slide.addClass('usingCss');
                }
                refresh.calL();
                if (settings.mode === "slide") {
                    refresh.calSW();
                    refresh.sSW();
                    if (settings.loop === true) {
                        slideValue = $this.slideValue();
                        this.move($el, slideValue);
                    }
                    if (settings.vertical === false) {
                        this.setHeight($el, false, true);
                    }

                } else {
                    this.setHeight($el, true, true);
                    $el.addClass('lSFade');
                    if (!this.doCss()) {
                        $children.not(".active").css('display', 'none');
                    }
                }
                if (settings.loop === true && settings.mode === 'slide') {
                    $children.eq(scene).addClass('active');
                } else {
                    $children.first().addClass('active');
                }
            },
            pager: function () {
                var $this = this;
                refresh.createPager = function () {
                    thumbWidth = (elSize - ((settings.thumbItem * (settings.thumbMargin)) - settings.thumbMargin)) / settings.thumbItem;
                    var $children = $slide.find('.lslide');
                    var length = $slide.find('.lslide').length;
                    var i = 0,
                        pagers = '',
                        v = 0;
                    for (i = 0; i < length; i++) {
                        if (settings.mode === 'slide') {
                            // calculate scene * slide value
                            if (!settings.autoWidth) {
                                v = i * ((slideWidth + settings.slideMargin) * settings.slideMove);
                            } else {
                                v += ((parseInt($children.eq(i).width()) + settings.slideMargin) * settings.slideMove);
                            }
                        }
                        var thumb = $children.find('img').eq(i * settings.slideMove).attr('data-thumb');
                        
                        if (settings.gallery === true) {
                            pagers += '<li style="width:100%;' + property + ':' + thumbWidth + 'px;' + gutter + ':' + settings.thumbMargin + 'px"><a href="#"><img src="' + thumb + '" /></a></li>';
                        } else {
                            pagers += '<li><a href="#">' + (i + 1) + '</a></li>';
                        }
                        if (settings.mode === 'slide') {
                            if ((v) >= w - elSize - settings.slideMargin) {
                                i = i + 1;
                                var minPgr = 2;
                                if (settings.autoWidth) {
                                    pagers += '<li><a href="#">' + (i + 1) + '</a></li>';
                                    minPgr = 1;
                                }
                                if (i < minPgr) {
                                    pagers = null;
                                    $slide.parent().addClass('noPager');
                                } else {
                                    $slide.parent().removeClass('noPager');
                                }
                                break;
                            }
                        }
                    }
                    var $cSouter = $slide.parent();
                    $cSouter.find('.lSPager').html(pagers);
                    if (!settings.vertical && settings.gallery) {
                        var $pgr = $slide.parent().find('.lSGallery');
                        setTimeout(function () {
                            $this.setHeight($pgr, false, false);
                        });
                    }
                    if (settings.gallery === true) {
                        if (settings.vertical === true) {
                            // set Gallery thumbnail width
                            $cSouter.find('.lSPager').css('width', settings.vThumbWidth + 'px');
                        }
                        pagerWidth = (i * (settings.thumbMargin + thumbWidth)) + 0.5;
                        $cSouter.find('.lSPager').css({
                            property: pagerWidth + 'px',
                            'transition-duration': settings.speed + 'ms'
                        });
                        if (settings.vertical === true) {
                            $slide.parent().css('padding-right', (settings.vThumbWidth + settings.galleryMargin) + 'px');
                        }
                        $cSouter.find('.lSPager').css(property, pagerWidth + 'px');
                    }
                    var $pager = $cSouter.find('.lSPager').find('li');
                    $pager.first().addClass('active');
                    $pager.on('click', function () {
                        if (settings.loop === true && settings.mode === 'slide') {
                            scene = scene + ($pager.index(this) - $cSouter.find('.lSPager').find('li.active').index());
                        } else {
                            scene = $pager.index(this);
                        }
                        $el.mode(false);
                        if (settings.gallery === true) {
                            $this.slideThumb();
                        }
                        clearInterval(interval);
                        return false;
                    });
                };
                if (settings.pager) {
                    var cl = 'lSpg';
                    if (settings.gallery) {
                        cl = 'lSGallery';
                    }
                    $slide.after('<ul class="lSPager ' + cl + '"></ul>');
                    var gMargin = (settings.vertical) ? "margin-left" : "margin-top";
                    $slide.parent().find('.lSPager').css(gMargin, settings.galleryMargin + 'px');
                    refresh.createPager();
                }

                setTimeout(function () {
                    refresh.init();
                }, 0);
            },
            setHeight: function (ob, fade, loop) {
                var obj = null;
                if (loop) {
                    obj = ob.children(".lslide ").first();
                } else {
                    obj = ob.children().first();
                }
                var setCss = function () {
                    var tH = obj.height(),
                        tP = 0,
                        tHT = tH;
                    if (fade) {
                        tH = 0;
                        tP = ((tHT) * 100) / elSize;
                    }
                    ob.css({
                        'height': tH + 'px',
                        'padding-bottom': tP + '%'
                    });
                };
                setCss();
                obj.find('img').load(function () {
                    setTimeout(function () {
                        setCss();
                    }, 100);
                });
            },
            active: function (ob, t) {
                if (this.doCss() && settings.mode === "fade") {
                    $slide.addClass('on');
                }
                var sc = 0;
                if (scene * settings.slideMove < length) {
                    ob.removeClass('active');
                    if (!this.doCss() && settings.mode === "fade" && t === false) {
                        ob.fadeOut(settings.speed);
                    }
                    t === true ? sc = scene : sc = scene * settings.slideMove;
                    if (t === true) {
                        var l = ob.length;
                        var nl = l - 1;
                        if (sc + 1 >= l) {
                            sc = nl;
                        }
                    }
                    if (settings.loop === true && settings.mode === 'slide') {
                        t === true ? sc = scene - $el.find('.clone.left').length : sc = scene * settings.slideMove;
                        if (t === true) {
                            var l = ob.length;
                            var nl = l - 1;
                            if (sc + 1 == l) {
                                sc = nl;
                            } else if (sc + 1 > l) {
                                sc = 0;
                            }
                        }
                    }

                    if (!this.doCss() && settings.mode === "fade" && t === false) {
                        ob.eq(sc).fadeIn(settings.speed);
                    }
                    ob.eq(sc).addClass('active');
                } else {
                    ob.removeClass('active');
                    ob.eq(ob.length - 1).addClass('active');
                    if (!this.doCss() && settings.mode === "fade" && t === false) {
                        ob.fadeOut(settings.speed);
                        ob.eq(sc).fadeIn(settings.speed);
                    }
                }
            },
            move: function (ob, v) {
                if (settings.rtl === true) {
                    v = -v;
                }
                if (this.doCss()) {
                    //if (settings.vertical === true) {
                    //    ob.css({
                    //        'transform': 'translate3d(0px, ' + (-v) + 'px, 0px)',
                    //        '-webkit-transform': 'translate3d(0px, ' + (-v) + 'px, 0px)'
                    //    });
                    //} else {
                    //    ob.css({
                    //        'transform': 'translate3d(' + (-v) + 'px, 0px, 0px)',
                    //        '-webkit-transform': 'translate3d(' + (-v) + 'px, 0px, 0px)',
                    //    });
                    //}
                } else {
                    if (settings.vertical === true) {
                        ob.css('position', 'relative').animate({
                            top: -v + 'px'
                        }, settings.speed, settings.easing);
                    } else {
                        ob.css('position', 'relative').animate({
                            left: -v + 'px'
                        }, settings.speed, settings.easing);
                    }
                }
                var $thumb = $slide.parent().find('.lSPager').find('li');
                this.active($thumb, true);
            },
            fade: function () {
                this.active($children, false);
                var $thumb = $slide.parent().find('.lSPager').find('li');
                this.active($thumb, true);
            },
            slide: function () {
                var $this = this;
                refresh.calSlide = function () {
                    if (w > elSize) {
                        slideValue = $this.slideValue();
                        $this.active($children, false);
                        if ((slideValue) > w - elSize - settings.slideMargin) {
                            slideValue = w - elSize - settings.slideMargin;
                        } else if (slideValue < 0) {
                            slideValue = 0;
                        }
                        $this.move($el, slideValue);
                        if (settings.loop === true && settings.mode === 'slide') {
                            if (scene >= (length - ($el.find('.clone.left').length / settings.slideMove))) {
                                $this.resetSlide($el.find('.clone.left').length);
                            }
                            if (scene === 0) {
                                $this.resetSlide($slide.find('.lslide').length);
                            }
                        }
                    }
                };
                refresh.calSlide();
            },
            resetSlide: function (s) {
                var $this = this;
                $slide.find('.lSAction a').addClass('disabled');
                setTimeout(function () {
                    scene = s;
                    $slide.css('transition-duration', '0ms');
                    slideValue = $this.slideValue();
                    $this.active($children, false);
                    plugin.move($el, slideValue);
                    setTimeout(function () {
                        $slide.css('transition-duration', settings.speed + 'ms');
                        $slide.find('.lSAction a').removeClass('disabled');
                    }, 50);
                }, settings.speed + 100);
            },
            slideValue: function () {
                var _sV = 0;
                if (settings.autoWidth === false) {
                    _sV = scene * ((slideWidth + settings.slideMargin) * settings.slideMove);
                } else {
                    _sV = 0;
                    for (var i = 0; i < scene; i++) {
                        _sV += (parseInt($children.eq(i).width()) + settings.slideMargin);
                    }
                }
                return _sV;
            },
            slideThumb: function () {
                var position;
                switch (settings.currentPagerPosition) {
                    case 'left':
                        position = 0;
                        break;
                    case 'middle':
                        position = (elSize / 2) - (thumbWidth / 2);
                        break;
                    case 'right':
                        position = elSize - thumbWidth;
                }
                var sc = scene - $el.find('.clone.left').length;
                var $pager = $slide.parent().find('.lSPager');
                if (settings.mode === 'slide' && settings.loop === true) {
                    if (sc >= $pager.children().length) {
                        sc = 0;
                    } else if (sc < 0) {
                        sc = $pager.children().length;
                    }
                }
                var thumbSlide = sc * ((thumbWidth + settings.thumbMargin)) - (position);
                if ((thumbSlide + elSize) > pagerWidth) {
                    thumbSlide = pagerWidth - elSize - settings.thumbMargin;
                }
                if (thumbSlide < 0) {
                    thumbSlide = 0;
                }
                this.move($pager, thumbSlide);
            },
            auto: function () {
                if (settings.auto) {
                    interval = setInterval(function () {
                        $el.goToNextSlide();
                    }, settings.pause);
                }
            },

            touchMove: function (endCoords, startCoords) {
                $slide.css('transition-duration', '0ms');
                if (settings.mode === 'slide') {
                    var distance = endCoords - startCoords;
                    var swipeVal = slideValue - distance;
                    if ((swipeVal) >= w - elSize - settings.slideMargin) {
                        if (settings.freeMove === false) {
                            swipeVal = w - elSize - settings.slideMargin;
                        } else {
                            var swipeValT = w - elSize - settings.slideMargin;
                            swipeVal = swipeValT + ((swipeVal - swipeValT) / 5);

                        }
                    } else if (swipeVal < 0) {
                        if (settings.freeMove === false) {
                            swipeVal = 0;
                        } else {
                            swipeVal = swipeVal / 5;
                        }
                    }
                    this.move($el, swipeVal);
                }
            },

            touchEnd: function (distance) {
                $slide.css('transition-duration', settings.speed + 'ms');
                clearInterval(interval);
                if (settings.mode === 'slide') {
                    var mxVal = false;
                    var _next = true;
                    slideValue = slideValue - distance;
                    if ((slideValue) > w - elSize - settings.slideMargin) {
                        slideValue = w - elSize - settings.slideMargin;
                        if (settings.autoWidth === false) {
                            mxVal = true;
                        }
                    } else if (slideValue < 0) {
                        slideValue = 0;
                    }
                    var gC = function (next) {
                        var ad = 0;
                        if (!mxVal) {
                            if (next) {
                                ad = 1;
                            };
                        }
                        if (!settings.autoWidth) {
                            var num = slideValue / ((slideWidth + settings.slideMargin) * settings.slideMove);
                            scene = parseInt(num) + ad;
                            if (slideValue >= (w - elSize - settings.slideMargin)) {
                                if (num % 1 !== 0) {
                                    scene++;
                                }
                            }
                        } else {
                            var tW = 0;
                            for (var i = 0; i < $children.length; i++) {
                                tW += (parseInt($children.eq(i).width()) + settings.slideMargin);
                                scene = i + ad;
                                if (tW >= slideValue) {
                                    break;
                                }
                            }
                        }
                    };
                    if (distance >= settings.swipeThreshold) {
                        gC(false);
                        _next = false;
                    } else if (distance <= -settings.swipeThreshold) {
                        gC(true);
                        _next = false;
                    }
                    $el.mode(_next);
                    this.slideThumb();
                } else {
                    if (distance >= settings.swipeThreshold) {
                        $el.goToPrevSlide();
                    } else if (distance <= -settings.swipeThreshold) {
                        $el.goToNextSlide();
                    }
                }
            },



            enableDrag: function () {
                var $this = this;
                if (!isTouch) {
                    var startCoords = 0,
                        endCoords = 0,
                        isDraging = false;
                    $slide.on('mousedown', function (e) {
                        if (w < elSize) {
                            if (w !== 0) {
                                return false;
                            }
                        }
                        if ($(e.target).attr('class') !== ('lSPrev') && $(e.target).attr('class') !== ('lSNext')) {
                            startCoords = (settings.vertical === true) ? e.pageY : e.pageX;
                            isDraging = true;
                            e.preventDefault();
                        }
                    });
                    $(window).on('mousemove', function (e) {
                        if (isDraging) {
                            endCoords = (settings.vertical === true) ? e.pageY : e.pageX;
                            $this.touchMove(endCoords, startCoords);
                        }
                    });
                    $(window).on('mouseup', function (e) {
                        if (isDraging) {
                            isDraging = false;
                            endCoords = (settings.vertical === true) ? e.pageY : e.pageX;
                            var distance = endCoords - startCoords;
                            if (Math.abs(distance) >= settings.swipeThreshold) {
                                $(window).on('click.ls', function (e) {
                                    e.preventDefault();
                                    e.stopImmediatePropagation();
                                    e.stopPropagation();
                                    $(window).off('click.ls');
                                });
                            }

                            $this.touchEnd(distance);

                        }
                    });
                }
            },




            enableTouch: function () {
                var $this = this;
                if (isTouch) {
                    var startCoords = {},
                        endCoords = {};
                    $slide.on('touchstart', function (e) {
                        endCoords = e.originalEvent.targetTouches[0];
                        startCoords.pageX = e.originalEvent.targetTouches[0].pageX;
                        startCoords.pageY = e.originalEvent.targetTouches[0].pageY;
                    });
                    $slide.on('touchmove', function (e) {
                        if (w < elSize) {
                            if (w !== 0) {
                                return false;
                            }
                        }
                        var orig = e.originalEvent;
                        endCoords = orig.targetTouches[0];
                        var xMovement = Math.abs(endCoords.pageX - startCoords.pageX);
                        var yMovement = Math.abs(endCoords.pageY - startCoords.pageY);
                        if (settings.vertical === true) {
                            if ((yMovement * 3) > xMovement) {
                                e.preventDefault();
                            }
                            $this.touchMove(endCoords.pageY, startCoords.pageY);
                        } else {
                            if ((xMovement * 3) > yMovement) {
                                e.preventDefault();
                            }
                            $this.touchMove(endCoords.pageX, startCoords.pageX);
                        }

                    });
                    $slide.on('touchend', function () {
                        if (w < elSize) {
                            if (w !== 0) {
                                return false;
                            }
                        }
                        if (settings.vertical === true) {
                            var distance = endCoords.pageY - startCoords.pageY;
                        } else {
                            var distance = endCoords.pageX - startCoords.pageX;
                        }
                        $this.touchEnd(distance);
                    });
                }
            },
            build: function () {
                var $this = this;
                $this.initialStyle();
                $this.auto();
                if (this.doCss()) {

                    if (settings.enableTouch === true) {
                        $this.enableTouch();
                    }
                    if (settings.enableDrag === true) {
                        $this.enableDrag();
                    }
                }
                $this.pager();
                $this.controls();
                $this.keyPress();
            }
        };
        plugin.build();
        refresh.init = function () {
            refresh.chbreakpoint();
            if (settings.vertical === true) {
                if (settings.item > 1) {
                    elSize = settings.verticalHeight;
                } else {
                    elSize = $children.outerHeight();
                }
                $slide.css('height', elSize + 'px');
            } else {
                elSize = $slide.outerWidth();
            }
            if (settings.loop === true && settings.mode === 'slide') {
                refresh.clone();
            }
            refresh.calL();
            if (settings.mode === "slide") {
                $el.removeClass('lSSlide');
            }
            if (settings.mode === "slide") {
                refresh.calSW();
                refresh.sSW();
            }
            setTimeout(function () {
                if (settings.mode === "slide") {
                    $el.addClass('lSSlide');
                }
            }, 1000);
            if (settings.pager) {
                refresh.createPager();
            }
            if (settings.adaptiveHeight === true && settings.vertical === false) {
                $el.css('height', $children.eq(scene).height());
            }
            if (settings.gallery === true) {
                plugin.slideThumb();
            }
            if (settings.mode === "slide") {
                plugin.slide();
            }
            if (settings.autoWidth === false) {
                if ($children.length <= settings.item) {
                    $slide.find('.lSAction').hide();
                } else {
                    $slide.find('.lSAction').show();
                }
            } else {
                if ((refresh.calWidth(false) < elSize) && (w !== 0)) {
                    $slide.find('.lSAction').hide();
                } else {
                    $slide.find('.lSAction').show();
                }
            }
        };
        $el.goToPrevSlide = function () {
            if (scene > 0) {
                settings.onBeforePrevSlide.call(this, $el, scene);
                scene--;
                $el.mode(false);
                if (settings.gallery === true) {
                    plugin.slideThumb();
                }
            } else {
                if (settings.loop === true) {
                    settings.onBeforePrevSlide.call(this, $el, scene);
                    if (settings.mode === 'fade') {
                        var l = (length - 1);
                        scene = parseInt(l / settings.slideMove);
                    }
                    $el.mode(false);
                    if (settings.gallery === true) {
                        plugin.slideThumb();
                    }
                } else if (settings.slideEndAnimatoin === true) {
                    $el.addClass('leftEnd');
                    setTimeout(function () {
                        $el.removeClass('leftEnd');
                    }, 400);
                }
            }
        };
        $el.goToNextSlide = function () {
            var nextI = true;
            if (settings.mode === 'slide') {
                var _slideValue = plugin.slideValue();
                var nextI = _slideValue < w - elSize - settings.slideMargin;
            }
            if (((scene * settings.slideMove) < length - settings.slideMove) && nextI) {
                settings.onBeforeNextSlide.call(this, $el, scene);
                scene++;
                $el.mode(false);
                if (settings.gallery === true) {
                    plugin.slideThumb();
                }
            } else {
                if (settings.loop === true) {
                    settings.onBeforeNextSlide.call(this, $el, scene);
                    scene = 0;
                    $el.mode(false);
                    if (settings.gallery === true) {
                        plugin.slideThumb();
                    }
                } else if (settings.slideEndAnimatoin === true) {
                    $el.addClass('rightEnd');
                    setTimeout(function () {
                        $el.removeClass('rightEnd');
                    }, 400);
                }
            }
        };
        $el.mode = function (_touch) {
            if (settings.adaptiveHeight === true && settings.vertical === false) {
                $el.css('height', $children.eq(scene).height());
            }
            if (on === false) {
                if (settings.mode === "slide") {
                    if (plugin.doCss()) {
                        $el.addClass('lSSlide');
                        if (settings.speed !== '') {
                            $slide.css('transition-duration', settings.speed + 'ms');
                        }
                        if (settings.cssEasing !== '') {
                            $slide.css('transition-timing-function', settings.cssEasing);
                        }
                    }
                } else {
                    if (plugin.doCss()) {
                        if (settings.speed !== '') {
                            $el.css('transition-duration', settings.speed + 'ms');
                        }
                        if (settings.cssEasing !== '') {
                            $el.css('transition-timing-function', settings.cssEasing);
                        }
                    }
                }
            }
            if (!_touch) {
                settings.onBeforeSlide.call(this, $el, scene);
            }
            if (settings.mode === "slide") {
                plugin.slide();
            } else {
                plugin.fade();
            }
            setTimeout(function () {
                if (!_touch) {
                    settings.onAfterSlide.call(this, $el, scene);
                }
            }, settings.speed);
            on = true;
        };
        $el.play = function () {
            clearInterval(interval);
            $el.goToNextSlide();
            interval = setInterval(function () {
                $el.goToNextSlide();
            }, settings.pause);
        };
        $el.pause = function () {
            clearInterval(interval);
        };
        $el.refresh = function () {
            refresh.init();
        };
        $el.getCurrentSlideCount = function () {
            var sc = scene;
            if (settings.loop) {
                var ln = $slide.find('.lslide').length,
                    cl = $el.find('.clone.left').length;
                if (scene <= cl - 1) {
                    sc = ln + (scene - cl);
                } else if (scene >= (ln + cl)) {
                    sc = scene - ln - cl;
                } else {
                    sc = scene - cl;
                }
            };
            return sc + 1;
        };
        $el.getTotalSlideCount = function () {
            return $slide.find('.lslide').length;
        };
        $el.goToSlide = function (s) {
            if (settings.loop) {
                scene = (s + $el.find('.clone.left').length - 1);
            } else {
                scene = s;
            }
            $el.mode(false);
            if (settings.gallery === true) {
                plugin.slideThumb();
            }
        };
        setTimeout(function () {
            settings.onSliderLoad.call(this, $el);
        }, 10);
       
        return this;
    };
}(jQuery));;
(function () {
    "use strict";

    /*
            Example HTML:
    
            <div class="tabs" data-module="tabs">
                <ul class="tabs-handles">
                    <li class="tabs-handle" data-name="tab-one">Tab One</li>
                    <li class="tabs-handle" data-name="tab-two">Tab Two</li>
                </ul>
    
                <div class="tabs-panels">
                    <div class="tabs-panel">
                        <!-- panel 1 -->
                    </div>
    
                    <div class="tabs-panel">
                        <!-- panel 2 -->
                    </div>
                </div>
            </div>
        */

    var moduleObj = moduler('tabs', {
        defaults: {
            event: 'click',
            handles: '.Tabs-handle',
            panels: '.Tabs-panel',
            activeClass: 'is-active',
            togglable: false,
            // whether to allow a panel to close if you click on its handle again.
            showFirst: true,
            // whether to show first panel on load.
            selectedPanel: null // the panel to show at page load (optional).
        },

        init: function (module) {
            module.$handles = module.$element.find(module.settings.handles);
            module.$panels = module.$element.find(module.settings.panels);

            module.$handles.on(module.settings.event, module, moduleObj.listen.showPanel);

            if (module.settings.selectedPanel) {
                module.$handles.filter('[data-name=' + module.settings.selectedPanel + ']').trigger(module.settings.event);
            } else if (module.settings.showFirst) {
                module.$handles.first().trigger(module.settings.event);
            }
        },

        listen: {
            showPanel: mo.event(function (module, e) {
                e.preventDefault();

                var $handle = $(e.target),
                    settings = module.settings,
                    handleIndex = module.$handles.index($handle),
                    $panel = module.$panels.eq(handleIndex);

                // if event was triggered on a link inside "handles" then we try to find the handle element now
                if (!$handle.is(module.settings.handles)) {
                    $handle = $handle.closest(module.settings.handles);
                    handleIndex = module.$handles.index($handle);
                    $panel = module.$panels.eq(handleIndex);
                }

                module.$handles.not($handle).removeClass(settings.activeClass).trigger('tab-hide');
                module.$panels.not($panel).removeClass(settings.activeClass).trigger('tab-hide');

                var classFuncName = settings.togglable ? 'toggleClass' : 'addClass';
                $handle[classFuncName](settings.activeClass).trigger('tab-show');
                $panel[classFuncName](settings.activeClass).trigger('tab-show');
            })
        },

        destroy: function (module) {
            module.$handles.off(module.settings.event, moduleObj.listen.showPanel);
        }
    });

})();;
(function() {
  "use strict";

  var moduleObj = moduler('modal', {
    defaults: {
      event: 'click',
      // the event to open the modal on
      contentElement: null,
      onload:false,
      // selector for the  Modal component
      replaceHtmlAfterClose: true,
      // if true will restore the html to the initial state
      activeCssClass: 'Modal--active',
      maxCssClass: 'is-maximized'
      
    },

    init: function(module) {
      module.$contentElement = $(module.settings.contentElement);
      module.onload = $(module.settings.onload);
      module.contentElementHtml = module.$contentElement.html();
      moduleObj.initEvents(module);
      if (module.settings.onload) {
            module.$contentElement = $(this);
            $(window).load(function () {
              module.$contentElement.addClass(module.settings.activeCssClass);
              module.$contentElement.add(module.$element).trigger('modal-open');
          });
      }
    },

    initEvents: function(module) {

      // opening the modal
      module.$element.on(module.settings.event, function(e) {
        e.preventDefault();

        // move modal element to body to avoid z-index issues.
        if (!module.$contentElement.parent().is('body')) {
          module.$contentElement.detach().appendTo('body');
        }

        module.$contentElement.addClass(module.settings.activeCssClass);
        module.$contentElement.add(module.$element).trigger('modal-open');
      });

      // closing window by clicking close link
      module.$contentElement.on('click', '.js-close', function(e) {
        e.preventDefault();
       
        moduleObj.closeDialog(module);
      });
      module.$contentElement.on('click', '.js-max', function (e) {
          e.preventDefault();
          $(this).toggleClass('Modal-min');
          moduleObj.maximizeDialog(module);
      });
      // closing window by clicking overlay
      //module.$contentElement.on('click', function(e) {
      //  if (!$(e.target).is('.Modal')) return;

      //  e.preventDefault();
      //  moduleObj.closeDialog(module);
      //});
    },
    maximizeDialog: function(module){
        module.$contentElement.toggleClass(module.settings.maxCssClass);
    },
    closeDialog: function(module) {
      module.$contentElement.removeClass(module.settings.activeCssClass);

      if (module.settings.replaceHtmlAfterClose) {
        module.$contentElement.html(module.contentElementHtml);

        if ('validator' in $ && 'unobtrusive' in $.validator) {
          $.validator.unobtrusive.parse(module.settings.contentElement);
        }
      }

      module.$contentElement.add(module.$element).trigger('modal-close');
    }
  });

})();;
var symetra = symetra || {};

symetra = {
    vars: {},
    init: function () {
        symetra.symbolSuperscript.init();

        symetra.carousel.init();
        symetra.oldBrowsers.init();
        symetra.downloadForm.init();
        symetra.datepicker.init();
        symetra.tooltip.init();
        symetra.oldBroswercheck.init();
        symetra.blueListLinkWrapper.init();
        symetra.sameHeightBlocks.init();
        symetra.dropdown.init();
        symetra.timeline.init();

        symetra.shoppingCart.checkForClearCart();
    },

    timeline: {
        init: function () {
            var $timeline = $("#timeline-embed");

            if (!!$timeline && $timeline.length > 0) {
                createStoryJS({
                    embed_id: 'timeline-embed',
                    type: 'timeline',
                    width: "100%",
                    height: "100%",
                    js: window.location.protocol + '//cdn.knightlab.com/libs/timeline/latest/js/timeline-min.js',
                    css: '/Assets/Styles/timeline.css',
                    source: { "timeline": timeline_data }
                });
            }
        }
    },

    sameHeightBlocks: {
        init: function () {
            if ($('.js-sameHeight').length) {
                tallest = 0;
                $('.js-sameHeight').each(function () {
                    thisHeight = $(this).height();
                    if (thisHeight > tallest) {
                        tallest = thisHeight;
                    }
                });
                $('.js-sameHeight').height(tallest);
            }
        }
    },

    symbolSuperscript: {
        init: function () {
            var bodyHtml = $("p,span,h1,h2,h3,h4,h5,a").each(function (index, element) {
                var $p = $(element);
                var elementHtml = $p.html();

                if (!!elementHtml.match(/®/ig) || !!elementHtml.match(/©/ig)) {
                    elementHtml = elementHtml.replace(/®/ig, '<sup>&reg;</sup>');
                    elementHtml = elementHtml.replace(/©/ig, '<sup>&copy;</sup>');
                    //elementHtml = elementHtml.replace(//ig)

                    element.innerHTML = elementHtml;
                }
            });
        }
    },

    tooltip: {
        init: function () {
            $('.Tooltip').tooltipster({
                maxWidth: 260,
                position: "right"
            });

        }
    },

    blueListLinkWrapper: {
        init: function () {
            $(".TeaserList-body").each(function (index, element) {
                var $element = $(element);
                var $wrappingAnchor = $element.parents("a.block.TeaserList-item");
                $wrappingAnchor.attr("href", $element.data("set-link"));
            });
        }
    },
    dropdown:{
        init: function () {
            $('.Dropdown-handle, .Dropdown-panel').on({
                mouseenter: function () {
                    if ($(this).hasClass('Dropdown-handle')) {
                        $(this).parent().find('.Dropdown-panel').stop(1, 0).fadeIn(); // do not advance the fadeOut animation to end (flicker)
                    } else {
                        $(this).stop(1, 0).fadeIn();
                    }
                   
                },
                mouseleave: function () {
                    if ($(this).hasClass('Dropdown-handle')) {
                        $(this).parent().find('.Dropdown-panel').stop(1, 1).fadeOut();
                    } else {
                        $(this).stop(1, 1).fadeOut();
                    }
                    
                }
            });
        }
    },
    shoppingCart: {
        init: function () {
            $('.Shoppingcart,.Shoppingcart-tooltip').on({
                mouseenter: function () {
                    $(this).find('.Shoppingcart-tooltip').stop(1, 0).fadeIn(); // do not advance the fadeOut animation to end (flicker)
                },
                mouseleave: function () {
                    $(this).find('.Shoppingcart-tooltip').stop(1, 1).fadeOut();
                }
            });
        },

        checkForClearCart: function () {
            if (!!window.location.search.match(/clearcart=true/ig)) {
                window.localStorage.clear();
                $(window).trigger("shoppingcartclear");
            }
        }
    },

    carousel: {
        init: function () {
            $(".js-carousel").each(function (sliderIndex, slider) {
                var $slider = $(slider);
                var $parentCarousel = $(slider).parent(".Carousel");
                var hasManySlides = $(".Carousel-item", $slider).length > 1;
                var slideDelay = $slider.parent("[data-slide-delay]").data("slide-delay");

                if (hasManySlides) {
                    if (isNaN(slideDelay)) {
                        slideDelay = 7;
                    }

                    var slider = $slider.lightSlider({
                        gallery: hasManySlides,
                        item: 1,
                        pause: slideDelay * 1000,
                        speed: 500,
                        controls: false,
                        loop: true,
                        slideMargin: 0,
                        mode: "fade",
                        auto: true,
                        thumbItem: hasManySlides ? 3 : 0,
                        onSliderLoad: function () {
                            if (hasManySlides) {
                                $('.lSGallery', $parentCarousel).append('<li class="Carousel-controls"><a href="#" class="Carousel-play"></a><a href="#" class="Carousel-pause"></a></li>');

                                $('.Carousel-play', $parentCarousel).click(function (e) {
                                    e.preventDefault();
                                    slider.play();
                                });
                                $('.Carousel-pause', $parentCarousel).click(function (e) {
                                    e.preventDefault();
                                    slider.pause();

                                });
                            }
                        }
                    });
                }
            });
        }

    },
    oldBrowsers: {
        init: function () {
            $(".oldie .NavigationPrimary-list li:last-child").addClass("oldie-last");
            if ($('html').hasClass('oldie')) {
                var new_src = ('/Assets/Images/SymetraLogoOldies.png');
                $('.Logo img').attr('src', new_src);
            }
            //fix for first image slide not showing up in old browsers
            $('.ie9 .Carousel-item,.oldie .Carousel-item').first().css({ 'display': 'block' });
            // IE8 fix for footer columns 
            $('.oldie .Grid--footer .Grid-cell:nth-child(1)').css({ 'width': '183px' });
            $('.oldie .Grid--footer .Grid-cell:nth-child(2)').css({ 'width': '218px' });
            $('.oldie .Grid--footer .Grid-cell:nth-child(3)').css({ 'width': '188px' });
            $('.oldie .Grid--footer .Grid-cell:nth-child(4)').css({ 'width': '209px', 'padding-right': '68px' });
            $('.oldie .Grid--footer .Grid-cell:nth-child(5)').css({ 'width': '135px' });
        }
    },
    downloadForm: {
        init: function () {
            $('.Box input[type=radio]').each(function () {
                $(this).on("click", function () {
                    $(this).parent().parent().parent().find('.Box-panel').removeClass('is-active');
                    if (this.checked) {
                        $(this).parent().addClass('is-active');
                    }
                });
            });
            $('.Expandable-link-tier').click(function (e) {
                $('.Expandable-link-tier').removeClass('is-active');
                e.preventDefault();
                $(this).addClass('is-active');
            });
        }
    },
    datepicker: {
        init: function () {
            $('.InputGroup-addon').datepicker({
                format: "mm/dd/yyyy"
            });

            $(".InputGroup-futureDatePicker").datepicker({
                startDate: "day",
                format: "mm/dd/yyyy"
            });
        }
    },
    oldBroswercheck: {
        init: function () {
            var cookieName = "SYMBrowserOutdated";
            var getCookieHelper = function (cname) {
                var name = cname + "=";
                var ca = document.cookie.split(';');
                for (var i = 0; i < ca.length; i++) {
                    var c = ca[i];
                    while (c.charAt(0) == ' ') c = c.substring(1);
                    if (c.indexOf(name) == 0) return c.substring(name.length, c.length);
                }
                return "";
            };

            var setCookieHelper = function () {
                var expirationDateTicks = new Date();
                expirationDateTicks.setTime(expirationDateTicks.getTime() + (30 * 24 * 60 * 60 * 1000));
                var expires = "expires=" + expirationDateTicks.toUTCString();
                document.cookie = cookieName + "=Clicked;" + expires + "; path=/; domain=" + window.location.hostname;
            };

            var hasForceCookieHash = (!!window.location.hash && window.location.hash == "#browserwarning");
            var isOldBrowser = this.isOldBrowserVersion();

            if (!Modernizr.cssgradients || hasForceCookieHash || isOldBrowser) {
                var $browserSupportBanner = $(".BrowserSupport");
                var $header = $("header");
                var oldHeaderHeight = parseInt($header.css("padding-top"));

                if (getCookieHelper(cookieName) == "" || hasForceCookieHash) {
                    var bannerHeight = $browserSupportBanner.height();
                    var bannerClickUrl = $browserSupportBanner.attr("data-click-target");

                    $browserSupportBanner.slideDown("fast");

                    $header.animate({
                        "padding-top": oldHeaderHeight + bannerHeight + "px"
                    }, "fast");

                    $browserSupportBanner.on('click', function (e) {
                        if (!e.target.tagName.match(/a/i)) {
                            e.preventDefault();

                            setCookieHelper();

                            if (!!bannerClickUrl && bannerClickUrl.length > 0) {
                                window.location = bannerClickUrl;
                            } else {
                                $browserSupportBanner.slideUp("fast");

                                $header.animate({
                                    "padding-top": oldHeaderHeight + "px"
                                }, "fast");
                            }
                        }
                    });
                }
            }
        },
        isOldBrowserVersion: function () {
            if (/MSIE 10/i.test(navigator.userAgent)) {
                // This is internet explorer 10
                return true;
            }
            return false;
        }
    }
}

$(document).ready(function () {
    symetra.init();
});

;
(function () {
    "use strict";
    
    var moduleBase = {
        shared: {
            shouldUpdateUrlHash: true,

            getHashValue: function (key) {
                var hash = window.location.hash;

                if (!!hash) {
                    var hashMatches = hash.match(new RegExp(key + '=([^&]*)'));
                    if (hashMatches != null && hashMatches.length > 1) {
                        return hashMatches[1];
                    }
                }
            },

            seedTabFromUrl: function (module) {
                var hashState = moduleBase.shared.getHashValue("tab");

                if (!!hashState) {
                    var $tabHandle = $("[data-tab-handle='" + hashState + "']");
                    $tabHandle.click();
                }
            },

            parseWidgetDataFromJson: function (pageId, blockId) {
                var newQueryString = moduleBase._private.getFullQueryParameters(pageId, blockId);

                var serviceUrl = '/api/FormsDownloadData/' + newQueryString;

                return $.ajax({ url: serviceUrl }).then(function (jsonData) {
                    var data = {};

                    data.formWebAudiences = jsonData.formWebAudienceTerms;

                    _(data.formWebAudiences).each(function (formWebAudience) {
                        var splitName = _(formWebAudience.name.split("-")).chain().invoke("trim").value();
                        var lastIndex = splitName.length - 1;

                        formWebAudience.audienceType = splitName[0].trim();
                        formWebAudience.actionName = splitName.slice(1, lastIndex).join("-").trim();
                        formWebAudience.actionType = splitName[lastIndex].trim();
                    });

                    data.productCategories = jsonData.productCategoryTerms;

                    data.states = jsonData.stateTerms;

                    data.productOfferings = jsonData.partnerFootprint.products;

                    var allProductStates = _(data.productOfferings).chain().pluck("states").flatten().uniq().value();

                    data.states = _(data.states).filter(function (stateObj) {
                        return allProductStates.indexOf(stateObj.guid) != -1;
                    });

                    data.forms = jsonData.forms;

                    _(data.forms).each(function (form) {
                        form.formAudiencesObjects = _(form.formAudiences).chain().map(function (formAudienceGuid) {
                            return _(data.formWebAudiences).findWhere({ guid: formAudienceGuid });
                        }).without(undefined).value();
                    });

                    data.selections = {};

                    return data;
                }, function (response) {
                    console.error("Error getting widget data:", arguments);
                });
            },

            //transaction type name is obsolete
            getApplicableFormsForSelections: function (forms, productCategories, productOfferings, stateGuid, subcategoryGuid, transactionTypeName, categoryGuid, productGuid) {
                return moduleBase._private.getApplicableFormsForSelections(forms, productCategories, productOfferings, stateGuid, subcategoryGuid, transactionTypeName, categoryGuid, productGuid);
            },

            //obsolete?
            shouldOfferProduct: function (productOfferings, productTermGuid, stateId) {
                return _(productOfferings).any(function (productOffering) {
                    return moduleBase._private.productAppliesToOffering(productOffering, productTermGuid, stateId);
                });
            },

            updateUrlHash: function(selections) {
                if (moduleBase.shared.shouldUpdateUrlHash && !!selections) {
                    var hashArgs = [];

                    if (!!selections.state) {
                        hashArgs.push("state=" + selections.state.guid);
                    }
                    
                    if (!!selections.category) {
                        hashArgs.push("category=" + selections.category.guid);
                    }

                    if (!!selections.subcategory) {
                        hashArgs.push("subcategory=" + selections.subcategory.guid);
                    }

                    if (!!selections.product) {
                        hashArgs.push("product=" + selections.product.guid);
                    }

                    window.location.replace("#" + hashArgs.join("&"));
                }
            }
        },

        _private: {
            getFullQueryParameters: function (pageId, blockId) {
                var hasExistingUrlQuery = (!!window.location.search && window.location.search.length > 0);

                var newQueryArgs = "?";
                var hasFirstArgument = false;

                if (hasExistingUrlQuery) {
                    newQueryArgs = window.location.search;
                    hasFirstArgument = true;
                }

                var newArgs = [{ key: "bust", value: new Date().getTime() },{ key: "pageId", value: pageId }, { key: "blockId", value: blockId }];

                for (var keyValueArgIndex in newArgs) {
                    var keyValueArg = newArgs[keyValueArgIndex];

                    if (hasFirstArgument) {
                        newQueryArgs += "&" + keyValueArg.key + "=" + keyValueArg.value;
                    } else {
                        newQueryArgs += keyValueArg.key + "=" + keyValueArg.value;
                        hasFirstArgument = true;
                    }
                }

                return newQueryArgs;
            },

            isFormValidProductOffering: function (form, productCategories, productOfferings, stateGuid, subcategoryGuid, transactionTypeName, categoryGuid, productGuid) {
                if (!!stateGuid) {
                    if (!!productGuid) {
                        var offering = _(productOfferings).findWhere({ guid: productGuid });

                        return !!offering && offering.states.indexOf(stateGuid) != -1;
                    }

                    if (!!categoryGuid) {
                        var categoryTerm = _(productCategories).findWhere({ guid: categoryGuid });

                        if (!!categoryTerm) {
                            var productIds = _(categoryTerm.terms).chain().pluck("terms").flatten().pluck("guid").value();

                            var partialIsValid = _.partial(symetra.formDownloadModuleBase._private.isFormValidProductOffering, form, productCategories, productOfferings, stateGuid, subcategoryGuid, undefined, undefined);

                            var hasValidChildProducts = _(productIds).chain().map(partialIsValid).value();

                            return _(hasValidChildProducts).some();
                        }
                    }

                    if (!!transactionTypeName) {
                        var hasTransactionType = _(form.formAudiencesObjects).some(function (formAudience) {
                            return formAudience.actionName == transactionTypeName;
                        });

                        var hasApplicableState = form.states.indexOf(stateGuid) != -1;

                        return hasTransactionType && hasApplicableState;
                    }
                }

                return false;
            }, function (form, productCategories, productOfferings, stateGuid, subcategoryGuid, transactionTypeName, categoryGuid, productGuid) {
                return "validProductOffering" + form.formId + stateGuid + subcategoryGuid + transactionTypeName + categoryGuid + productGuid;
            },

            //transaction type name is obsolete
            isValidProductOffering: function (forms, productCategories, productOfferings, stateGuid, subcategoryGuid, transactionTypeName, categoryGuid, productGuid) {
                return _(forms).any(function (form) {
                    return moduleBase._private.isFormValidProductOffering(form, productCategories, productOfferings, stateGuid, subcategoryGuid, transactionTypeName, categoryGuid, productGuid);
                });
            },

            //transaction type name is obsolete
            getApplicableFormsForSelections: function (forms, productCategories, productOfferings, stateGuid, subcategoryGuid, transactionTypeName, categoryGuid, productGuid) {
                if (!moduleBase._private.isValidProductOffering(forms, productCategories, productOfferings, stateGuid, subcategoryGuid, transactionTypeName, categoryGuid, productGuid))
                    return [];

                return _(forms).filter(function (form) {
                    return moduleBase._private.doesFormApplyToSelections(form, productCategories, productOfferings, stateGuid, subcategoryGuid, transactionTypeName, categoryGuid, productGuid);
                });
            },

            doesFormApplyToSelections: function (form, productCategories, productOfferings, stateGuid, subcategoryGuid, transactionTypeName, categoryGuid, productGuid) {
                var appliesToTransactionTypeFilter = false;
                var hasTransactionType = false;
                var hasApplicableState = false;
                var hasApplicableProduct = false;

                if (!!transactionTypeName) {
                    appliesToTransactionTypeFilter = true;

                    hasTransactionType = _(form.formAudiencesObjects).some(function (formAudience) {
                        return formAudience.actionName == transactionTypeName;
                    });
                }

                hasApplicableState = form.states.indexOf(stateGuid) != -1;

                if (!!productGuid) {
                    // Does state also apply to partner footprint?
                    hasApplicableState = hasApplicableState && _(productOfferings).findWhere({ guid: productGuid }).states.indexOf(stateGuid) != -1;
                }

                if (!!categoryGuid) {
                    if (!!subcategoryGuid) {
                        var productIdentifierPrefix = categoryGuid;

                        if (!!subcategoryGuid) {
                            productIdentifierPrefix = productIdentifierPrefix + "|" + subcategoryGuid;
                        }

                        if (!!productGuid) {
                            productIdentifierPrefix = productIdentifierPrefix + "|" + productGuid;
                        }

                        hasApplicableProduct = _(form.productIdentifiers).some(function (productIdent) {
                            return productIdent.indexOf(productIdentifierPrefix) == 0; // Starts with 
                        });
                    } else {
                        hasApplicableProduct = _(form.productIdentifiers).some(function (productIdent) {
                            var appliesToCategory = productIdent.indexOf(categoryGuid) == 0; // Starts with

                            if (!!productGuid) {
                                var appliesToProduct = productIdent.indexOf(productGuid) == (productIdent.length - productGuid.length);

                                return appliesToCategory && appliesToProduct;
                            }

                            return appliesToCategory;
                        });
                    }

                    if (appliesToTransactionTypeFilter && !hasTransactionType)
                        return false;

                    return hasApplicableState && hasApplicableProduct;
                }

                if (appliesToTransactionTypeFilter && !hasTransactionType)
                    return false;

                return hasApplicableState;

            }, function (form, productCategories, productOfferings, stateGuid, subcategoryGuid, transactionTypeName, categoryGuid, productGuid) {
                return "appliesToSelections" + form.formId + stateGuid + subcategoryGuid + transactionTypeName + categoryGuid + productGuid;
            },

            //obsolete?
            productAppliesToOffering: _.memoize(function (productOffering, productTermGuid, stateId) {
                return productOffering.guid == productTermGuid && productOffering.states.indexOf(stateId) >= 0;
            }, function (productOffering, productTermGuid, stateId) {
                return "productAppliesToOffering" + productOffering.guid + productTermGuid + stateId;
            }),
        }
    };

    symetra.formDownloadModuleBase = moduleBase;
})();;
(function() {
    "use strict";

    var moduleBase = {
        shared: {
            shouldUpdateUrlHash: true,

            getHashValue: function(key) {
                var hash = window.location.hash;

                if (!!hash) {
                    var hashMatches = hash.match(new RegExp(key + '=([^&]*)'));
                    if (hashMatches != null && hashMatches.length > 1) {
                        return hashMatches[1];
                    }
                }
            },

            seedTabFromUrl: function(module) {
                var hashState = moduleBase.shared.getHashValue("tab");

                if (!!hashState) {
                    var $tabHandle = $("[data-tab-handle='" + hashState + "']");
                    $tabHandle.click();
                }
            },

            parseWidgetDataFromJson: function (pageId, blockId) {
                var newQueryString = moduleBase._private.getFullQueryParameters(pageId, blockId);

                var serviceUrl = '/api/MarketingMaterialsData/' + newQueryString;

                return $.ajax({ url: serviceUrl }).then(function (jsonData) {
                    var data = {};

                    data.productCategories = jsonData.productCategoryTerms;
                    data.pieceCategories = jsonData.pieceCategoryTerms;

                    data.states = jsonData.stateTerms;

                    data.productOfferings = jsonData.partnerFootprint.products;

                    var allProductStates = _(data.productOfferings).chain().pluck("states").flatten().uniq().value();

                    data.states = _(data.states).filter(function (stateObj) {
                        return allProductStates.indexOf(stateObj.guid) != -1;
                    });

                    data.forms = jsonData.forms;

                    _(data.forms).each(function(form) {
                        form.formAudiencesObjects = _(form.formAudiences).chain().map(function(formAudienceGuid) {
                            return _(data.formWebAudiences).findWhere({ guid: formAudienceGuid });
                        }).without(undefined).value();

                        form.pieceCategoryObjects = _(form.pieceCategories).chain().map(function(pieceCategoryGuid) {
                            return _(data.pieceCategories).findWhere({ guid: pieceCategoryGuid });
                        }).without(undefined).value();
                    });

                    data.selections = {};

                    return data;
                }, function (response) {
                    console.error("Error getting widget data:", arguments);
                });
            },

            //transaction type name is obsolete
            getApplicableFormsForSelections: function(forms, productCategories, productOfferings, stateGuid, subcategoryGuid, pieceCategoryGuid, categoryGuid, productGuid) {
                return moduleBase._private.getApplicableFormsForSelections(forms, productCategories, productOfferings, stateGuid, subcategoryGuid, pieceCategoryGuid, categoryGuid, productGuid);
            },

            //obsolete?
            shouldOfferProduct: function(productOfferings, productTermGuid, stateId) {
                return _(productOfferings).any(function(productOffering) {
                    return moduleBase._private.productAppliesToOffering(productOffering, productTermGuid, stateId);
                });
            },

            updateUrlHash: function (selections) {
                if (moduleBase.shared.shouldUpdateUrlHash && !!selections) {
                    var hashArgs = [];

                    if (!!selections.state) {
                        hashArgs.push("state=" + selections.state.guid);
                    }

                    if (!!selections.category) {
                        hashArgs.push("category=" + selections.category.guid);
                    }

                    if (!!selections.subcategory) {
                        hashArgs.push("subcategory=" + selections.subcategory.guid);
                    }

                    if (!!selections.product) {
                        hashArgs.push("product=" + selections.product.guid);
                    }

                    window.location.replace("#" + hashArgs.join("&"));
                }
            }
        },

        _private: {
            getFullQueryParameters: function (pageId, blockId) {
                var hasExistingUrlQuery = (!!window.location.search && window.location.search.length > 0);

                var newQueryArgs = "?";
                var hasFirstArgument = false;

                if (hasExistingUrlQuery) {
                    newQueryArgs = window.location.search;
                    hasFirstArgument = true;
                }

                var newArgs = [{ key: "bust", value: new Date().getTime() }, { key: "pageId", value: pageId }, { key: "blockId", value: blockId }];

                for (var keyValueArgIndex in newArgs) {
                    var keyValueArg = newArgs[keyValueArgIndex];

                    if (hasFirstArgument) {
                        newQueryArgs += "&" + keyValueArg.key + "=" + keyValueArg.value;
                    } else {
                        newQueryArgs += keyValueArg.key + "=" + keyValueArg.value;
                        hasFirstArgument = true;
                    }
                }

                return newQueryArgs;
            },

            isFormValidProductOffering: _.memoize(function(form, productCategories, productOfferings, stateGuid, subcategoryGuid, pieceCategoryGuid, categoryGuid, productGuid) {
                    if (!!stateGuid) {
                        if (!!productGuid) {
                            var offering = _(productOfferings).findWhere({ guid: productGuid });

                            return !!offering && offering.states.indexOf(stateGuid) != -1;
                        }

                        if (!!categoryGuid) {
                            var categoryTerm = _(productCategories).findWhere({ guid: categoryGuid });

                            if (!!categoryTerm) {
                                var productIds = _(categoryTerm.terms).chain().pluck("terms").flatten().pluck("guid").value();

                                var partialIsValid = _.partial(moduleBase._private.isFormValidProductOffering, form, productCategories, productOfferings, stateGuid, subcategoryGuid, undefined, undefined);

                                var hasValidChildProducts = _(productIds).chain().map(partialIsValid).value();

                                return _(hasValidChildProducts).some();
                            }
                        }

                        if (!!pieceCategoryGuid) {
                            return _(form.pieceCategoryObjects).some(function(pieceCategory) {
                                return pieceCategory.guid == pieceCategoryGuid;
                            });
                        }
                    }

                    return false;
                },
                function(form, productCategories, productOfferings, stateGuid, subcategoryGuid, pieceCategoryGuid, categoryGuid, productGuid) {
                    return "validProductOffering" + form.formId + stateGuid + subcategoryGuid + pieceCategoryGuid + categoryGuid + productGuid;
                }),

            isValidProductOffering: function(forms, productCategories, productOfferings, stateGuid, subcategoryGuid, pieceCategoryGuid, categoryGuid, productGuid) {
                return _(forms).any(function(form) {
                    return moduleBase._private.isFormValidProductOffering(form, productCategories, productOfferings, stateGuid, subcategoryGuid, pieceCategoryGuid, categoryGuid, productGuid);
                });
            },

            //transaction name is obsolete
            getApplicableFormsForSelections: function(forms, productCategories, productOfferings, stateGuid, subcategoryGuid, pieceCategoryGuid, categoryGuid, productGuid) {
                if (!moduleBase._private.isValidProductOffering(forms, productCategories, productOfferings, stateGuid, subcategoryGuid, pieceCategoryGuid, categoryGuid, productGuid))
                    return [];

                return _(forms).chain().filter(function(form) {
                    return moduleBase._private.doesFormApplyToSelections(form, productCategories, productOfferings, stateGuid, subcategoryGuid, pieceCategoryGuid, categoryGuid, productGuid);
                }).sortBy("documentTitle").value();
            },

            doesFormApplyToSelections: _.memoize(function(form, productCategories, productOfferings, stateGuid, subcategoryGuid, pieceCategoryGuid, categoryGuid, productGuid) {
                var appliesToPieceCategoryFilter = false;
                var hasPieceCategory = false;
                var hasApplicableState = false;
                var hasApplicableProduct = false;

                if (!!pieceCategoryGuid) {
                    appliesToPieceCategoryFilter = true;

                    hasPieceCategory = _(form.pieceCategoryObjects).some(function(pieceCategory) {
                        return pieceCategory.guid == pieceCategoryGuid;
                    });
                }

                hasApplicableState = form.states.indexOf(stateGuid) != -1;

                if (!!productGuid) {
                    // Does state also apply to partner footprint?
                    hasApplicableState = hasApplicableState && _(productOfferings).findWhere({ guid: productGuid }).states.indexOf(stateGuid) != -1;
                }

                if (!!categoryGuid) {
                    if (!!subcategoryGuid) {
                        var productIdentifierPrefix = categoryGuid;

                        if (!!subcategoryGuid) {
                            productIdentifierPrefix = productIdentifierPrefix + "|" + subcategoryGuid;
                        }

                        if (!!productGuid) {
                            productIdentifierPrefix = productIdentifierPrefix + "|" + productGuid;
                        }

                        hasApplicableProduct = _(form.productIdentifiers).some(function(productIdent) {
                            var productIdentifierMatches = productIdent.indexOf(productIdentifierPrefix) == 0;

                            if (!productIdentifierMatches)
                                return false;

                            var productGuid = productIdent.substring(productIdent.lastIndexOf('|')+1);

                            return !!(_(productOfferings).findWhere({ guid: productGuid }));
                        });

                    } else {
                        hasApplicableProduct = _(form.productIdentifiers).some(function(productIdent) {
                            var appliesToCategory = productIdent.indexOf(categoryGuid) == 0; // Starts with

                            if (!!productGuid) {
                                var appliesToProduct = productIdent.indexOf(productGuid) == (productIdent.length - productGuid.length);

                                var productOfferingExists = !!(_(productOfferings).findWhere({ guid: productGuid }));

                                return appliesToCategory && appliesToProduct && productOfferingExists;
                            }

                            return appliesToCategory;
                        });
                    }

                    if (appliesToPieceCategoryFilter && !hasPieceCategory)
                        return false;

                    return hasApplicableState && hasApplicableProduct;
                }

                if (appliesToPieceCategoryFilter && !hasPieceCategory)
                    return false;

                return hasApplicableState;

            }, function(form, productCategories, productOfferings, stateGuid, subcategoryGuid, pieceCategoryGuid, categoryGuid, productGuid) {
                return "appliesToSelections" + form.formId + stateGuid + subcategoryGuid + pieceCategoryGuid + categoryGuid + productGuid;
            }),

            //obsolete?
            productAppliesToOffering: _.memoize(function(productOffering, productTermGuid, stateId) {
                return productOffering.guid == productTermGuid && productOffering.states.indexOf(stateId) >= 0;
            }, function(productOffering, productTermGuid, stateId) {
                return "productAppliesToOffering" + productOffering.guid + productTermGuid + stateId;
            }),
        }
    };

    symetra.marketingModuleBase = moduleBase;
})();;
(function () {
    "use strict";

    /*
        Example HTML:

        <div class="accordion" data-module="accordion">
            <h3 class="accordion-header">Panel 1</h3>
            <div class="accordion-panel">
                <!-- content 1 -->
            </div>

            <h3 class="accordion-header">Panel 2</h3>
            <div class="accordion-panel">
                <!-- content 2 -->
            </div>
        </div>
    */

    var moduleObj = moduler('accordion', {
        defaults: {
            event: 'click',
            headers: '.Accordion-handle',
            panels: '.Accordion-panel',
            activeClass: 'is-active',
            activeHeaderClass: 'is-active',
            
            iconClass: 'icon-arrowUp',
            
            mode: 'accordion', 
            expandFirst: false
        },
        
        init: function (module) {
            module.$headers = module.$element.find(module.settings.headers);
            module.$panels = module.$element.find(module.settings.panels);
            module.$icons = module.$element.find(module.settings.icon);
            module.$headers.on(module.settings.event, module, moduleObj.listen.expandPanel);

            if (module.settings.expandFirst) {
                module.$headers.first().trigger(module.settings.event);
            }
        },
        
        listen: {
            
            expandPanel: mo.event(function (module, e) {
                e.preventDefault();

                var $header = ( $(e.target).hasClass('Accordion-handle') ) ? $(e.target) : $(e.target).parents(module.settings.headers),
                    settings = module.settings,
                    headerIndex = module.$headers.index($header),
                    $panel = module.$panels.eq(headerIndex);
                

                if ($header.hasClass('inactive')) return;
               
                if (settings.mode == 'accordion') {
                    module.$headers.not($header).removeClass(settings.activeClass);
                    module.$panels.not($panel).removeClass(settings.activeClass);
                    module.$headers.not($header).removeClass(settings.activeHeaderClass);
                    // include this in module todo
                    $('.Filter-item span').not('.is-active.Filter-item span').removeClass('icon-arrowUp');
                    $('.DownloadAssets-headline span').not('.is-active.DownloadAssets-headline span').removeClass('icon-arrowUp');
                }

                $header.toggleClass(settings.activeHeaderClass);
                $panel.toggleClass(settings.activeClass);
                
                $header.find('span').toggleClass(settings.iconClass);
                
            })
        },
        
       
    });
    
})();;
(function () {
    "use strict";

    var nextElementSibling = function (el) {
        do { el = el.nextSibling } while (el && el.nodeType !== 1);
        return el;
    };

    var moduleObj = moduler('expressWidget', {
        defaults: {
            apiUrl: '/api/ExpressWidgetData',
            defaultSecondDropdownValue: '-- Select a State --',
            listChangeEvent: 'change',
            hiddenPageId: '[name=pageId]',
            hiddenBlockId: '[name=blockId]',

            productCategoryRadios: '.productCategoryRadio',
            productLists: '[data-list-type=product]',
            redirectList: '[data-list-type=redirect]',

            disabledClass: 'Select--disabled',

            actionButton: '.RedirectButtons',
            hideShowToggleClass: 'u-hiddenVisually'
        },

        getActiveProductList: function (module) {
            var selectedRadio = module.$element.find(module.settings.productCategoryRadios + ":checked");

            if (selectedRadio.length == 0) {
                return module.$productLists.first();
            }

            return module.$element.find(module.settings.productLists + "[data-category-guid=" + selectedRadio.data("category-guid") + "]");
        },

        init: function (module) {
            module.settings.initialProductSelection = module.$element.data("initial-product");
            module.settings.initialProductCategorySelection = module.$element.data("initial-product-category");

            module.$productCategoryRadios = module.$element.find(module.settings.productCategoryRadios);
            module.$productLists = module.$element.find(module.settings.productLists);
            module.$redirectList = module.$element.find(module.settings.redirectList);

            module.$hiddenPageId = module.$element.find(module.settings.hiddenPageId);
            module.$hiddenBlockId = module.$element.find(module.settings.hiddenBlockId);

            module.$actionButtons = module.$element.find(module.settings.actionButton);

            module.$productCategoryRadios.on(module.settings.listChangeEvent, module, moduleObj.listen.changedCategoryType);
            module.$productLists.on(module.settings.listChangeEvent, module, moduleObj.listen.changedProductType);
            module.$redirectList.on(module.settings.listChangeEvent, module, moduleObj.listen.changedRedirectOption);

            module.$actionButtons.on("click", "[data-track-button]", module, moduleObj.analytics.trackButtonClicked);

            // Initial Selection
            if (module.$productCategoryRadios.length == 1) {
                module.$productCategoryRadios.prop("checked", "true");
                module.$productCategoryRadios.trigger("change");
            }

            moduleObj.actions.repopulateRedirectList(module);
            moduleObj.setInitialValues(module);
        },

        setInitialValues: function (module) {
            var $productCategoryRadio = $(".productCategoryRadio[data-category-guid=\"" + module.settings.initialProductCategorySelection + "\"]");

            if ($productCategoryRadio.length > 0) {
                $productCategoryRadio.prop("checked", true);
                $productCategoryRadio.trigger(module.settings.listChangeEvent);

                var $activeProductList = moduleObj.getActiveProductList(module);
                var allProductDropdownValues = _($activeProductList[0].options).pluck("value");

                if (allProductDropdownValues.indexOf(module.settings.initialProductSelection) != -1) {
                    $activeProductList.val(module.settings.initialProductSelection);
                    $activeProductList.trigger(module.settings.listChangeEvent);
                }
            }
        },

        analytics: {

            trackProductCategoryChange: function (module) {
                var selectedRadio = module.$element.find(module.settings.productCategoryRadios + ":checked");
                
                if (selectedRadio.length > 0 && typeof gtag !== 'undefined') {
                    var label = selectedRadio.next();
                    gtag('event', 'Select Product Category', {
                        'event_category': 'Express Widget',
                        'event_label': label.text() + " [" + selectedRadio.data("category-guid") + "]"
                    });
                }
            },

            trackProductChange: function (module) {
                var activeProductList = moduleObj.getActiveProductList(module);
                var selectedOption = activeProductList.find("option:selected");

                if (!!selectedOption && typeof gtag !== 'undefined') {
                    gtag('event', 'Select Product', {
                        'event_category': 'Express Widget',
                        'event_label': selectedOption.text() + " [" + selectedOption.val() + "]"
                    });
                }
            },

            trackStateChange: function (module) {
                var selectedOption = module.$redirectList.find("option:selected");

                if (!!selectedOption && typeof gtag !== 'undefined') {
                    gtag('event', 'Select Redirect', {
                        'event_category': 'Express Widget',
                        'event_label': selectedOption.text()
                    });
                }
            },

            trackButtonClicked: mo.event(function (module, event) {
                var $target = $(event.currentTarget);

                if (typeof gtag !== 'undefined') {
                    gtag('event', 'Click Button', {
                        'event_category': 'Express Widget',
                        'event_label': $target.text() + " [" + $target.attr("href") + "]"
                    });
                }
            })
        },

        listen: {

            changedRedirectOption: mo.event(function (module, event) {
                var selectedOption = module.$redirectList.find("option:selected");

                moduleObj.resets.resetActionButton(module);

                var redirectListValueString = selectedOption.val();

                if (!!redirectListValueString && redirectListValueString != module.settings.defaultSecondDropdownValue && redirectListValueString.length > 0) {
                    var redirectListValues = redirectListValueString.split('|');
                    var buttonTextOptions = $(selectedOption).data("button-text").split('|');

                    var buttonConfigurations = _.zip(redirectListValues, buttonTextOptions);

                    if (buttonConfigurations.length > 0) {
                        var $allButtons = _.map(buttonConfigurations, function (buttonConfiguration) {
                            var newButton = $("<a class=\"Button RedirectButton\" target=\"_blank\" data-track-button=\"" + buttonConfiguration[1] +"\" />");

                            newButton.html(buttonConfiguration[1]);
                            newButton.attr("href", buttonConfiguration[0]);

                            return newButton;
                        });

                        moduleObj.analytics.trackStateChange(module);
                        module.$actionButtons.append($allButtons);
                    }
                }
            }),

            changedProductType: mo.event(function (module, event) {
                moduleObj.resets.resetRedirectList(module, false);
                
                if (document.activeElement == module.$redirectList[0]) {
                    module.$redirectList.blur();
                }

                moduleObj.analytics.trackProductChange(module);

                moduleObj.actions.repopulateRedirectList(module);
            }),

            changedCategoryType: mo.event(function (module, event) {
                moduleObj.resets.resetRedirectList(module, false);

                var $targetRadio = $(event.currentTarget);

                module.$productLists.hide();

                var activeProductList = moduleObj.getActiveProductList(module);

                moduleObj.analytics.trackProductCategoryChange(module);

                activeProductList.show();

                if (activeProductList[0].options.length > 1) {
                    activeProductList.val("");
                } else {
                    activeProductList.trigger("change");
                }
            })

        },

        resets: {
            resetRedirectList: function (module, shouldSeedDefault) {
                moduleObj.resets.resetActionButton(module);
                module.$redirectList.html("");

                moduleObj.disableDropdown(module, module.$redirectList);

                if (shouldSeedDefault == undefined || shouldSeedDefault === true) {
                    var defaultOption = $("<option/>");

                    defaultOption.html(module.settings.defaultSecondDropdownValue);

                    module.$redirectList.append(defaultOption);
                }
            },

            resetActionButton: function (module) {
                module.$actionButtons.empty();
            }
        },

        actions: {

            repopulateRedirectList: function (module) {
                moduleObj.resets.resetRedirectList(module, false);

                var $activeProductList = moduleObj.getActiveProductList(module);
                var productId = $activeProductList.val();

                if (!!productId && productId.length > 0) {
                    var apiUrl = module.settings.apiUrl;
                    if (window.location.search) {
                        apiUrl += window.location.search;
                    }
                    $.get(apiUrl, {
                        pageId: module.$hiddenPageId.val(),
                        blockId: module.$hiddenBlockId.val(),
                        productId: $activeProductList.val()
                    }, function (data, responseStatus) {
                        if (responseStatus == "success") {
                            if (!!data && data.length > 0) {

                                // This reset will NOT show a default option of "Select a Report" if there is only 1 option
                                moduleObj.resets.resetRedirectList(module, data.length > 1);

                                var groupedRedirectOptions = _(data).groupBy(function (redirectOption) {
                                    return redirectOption.OptionName;
                                });

                                var optionCount = 0;
                                var allOptions = _(groupedRedirectOptions).map(function (redirectOptions, redirectOptionKey) {
                                    var newOption = $("<option/>");

                                    var redirectUrls = _.pluck(redirectOptions, "OptionRedirectUrl").join('|');
                                    var buttonTexts = _.pluck(redirectOptions, "OptionButtonTitle").join('|');

                                    newOption.html(redirectOptionKey);
                                    newOption.val(redirectUrls);
                                    newOption.data("button-text", buttonTexts);

                                    optionCount++;

                                    return newOption;
                                });

                                moduleObj.enableDropdown(module, module.$redirectList);

                                module.$redirectList.append(allOptions);
                                
                                if (optionCount == 1) {
                                    module.$redirectList.trigger(module.settings.listChangeEvent);
                                }
                            }
                        }
                    });
                }
            }

        },

        disableDropdown: function (module, $element) {
            $element.addClass(module.settings.disabledClass);
            $element.prop("disabled", true);
        },

        enableDropdown: function (module, $element) {
            $element.removeClass(module.settings.disabledClass);
            $element.prop("disabled", false);
        },
    });

})();;
(function () {
    "use strict";

    var moduleObj = moduler('form-cleaner', {
        defaults: {
            event: "submit"
        },

        init: function (module) {
            module.$element.on(module.settings.event, module, moduleObj.listen.cleanForm);
        },

        listen: {
            cleanForm: mo.event(function (module) {
                module.$element.find("input, textarea").val(function (index, value) {
                    return moduleObj.stripHtml(value);
                });
            })
        },

        stripHtml: function (string) {
            return string.replace(/(<([^>]+)>)/ig, "");
        }
    });

})();;
(function () {
    "use strict";

    var moduleObj = moduler('generalRedirectBlock', {
        defaults: {
            apiUrl: '/api/GeneralRedirectData',

            defaultSecondDropdownValue: '-- Select a Report --',
            defaultSecondDropdownDataAttr: 'data-default-option',

            disabledClass: 'Select--disabled',

            listChangeEvent: 'change',
            hiddenPageId: '[name=pageId]',
            hiddenBlockId: '[name=blockId]',
            productList: '[data-list-type=product]',
            redirectList: '[data-list-type=redirect]',
            actionButton: '.RedirectButton',
            hideShowToggleClass: 'u-hiddenVisually'
        },

        init: function (module) {
            module.settings.apiUrl = module.$element.data("url");

            module.settings.initialProductSelection = module.$element.data("initial-product");

            module.$productList = module.$element.find(module.settings.productList);
            module.$redirectList = module.$element.find(module.settings.redirectList);
            module.$hiddenPageId = module.$element.find(module.settings.hiddenPageId);
            module.$hiddenBlockId = module.$element.find(module.settings.hiddenBlockId);
            module.$actionButton = module.$element.find(module.settings.actionButton);

            module.$productList.on(module.settings.listChangeEvent, module, moduleObj.listen.changedProductType);
            module.$redirectList.on(module.settings.listChangeEvent, module, moduleObj.listen.changedRedirectOption);
            module.$actionButton.on("click", module, moduleObj.analytics.trackReportView);

            moduleObj.actions.repopulateRedirectList(module);

            moduleObj.setInitialValue(module);
        },

        setInitialValue: function (module) {
            var allDropdownValues = _(module.$productList[0].options).pluck("value");

            if (allDropdownValues.indexOf(module.settings.initialProductSelection) != -1) {
                module.$productList.val(module.settings.initialProductSelection);
                module.$productList.trigger(module.settings.listChangeEvent);
            }
        },

        analytics: {
            getTypePrefix: function (module) {
                return module.$element.data("block-type") + " ";
            },

            trackProductChange: function (module) {
                var selectedOption = module.$productList.find("option:selected");

                if (typeof gtag !== 'undefined' && !!selectedOption) {
                    gtag('event', 'Select Product', {
                        'event_category': moduleObj.analytics.getTypePrefix(module) + 'Redirect Block',
                        'event_label': selectedOption.text() + " [" + selectedOption.val() + "]"
                    });
                }
            },

            trackReportChange: function (module) {
                var selectedOption = module.$redirectList.find("option:selected");

                if (typeof gtag !== 'undefined' && !!selectedOption) {
                    gtag('event', 'Select Report', {
                        'event_category': moduleObj.analytics.getTypePrefix(module) + 'Redirect Block',
                        'event_label': selectedOption.text() + " [" + selectedOption.val() + "]"
                    });
                }
            },

            trackReportView: mo.event(function (module, event) {
                var selectedProduct = module.$productList.find("option:selected");
                var selectedReport = module.$redirectList.find("option:selected");

                if (typeof gtag !== 'undefined') {
                    gtag('event', 'Click Go', {
                        'event_category': moduleObj.analytics.getTypePrefix(module) + 'Redirect Block',
                        'event_label': selectedProduct.text() + " - " + selectedReport.text() + " [" + selectedReport.val() + "]"
                    });
                }
            })
        },

        listen: {

            changedRedirectOption: mo.event(function (module, event) {
                event.preventDefault();

                var redirectListValue = module.$redirectList.val();

                var defaultAttrValue = module.$redirectList.attr(module.settings.defaultSecondDropdownDataAttr);
                defaultAttrValue = (!!defaultAttrValue && defaultAttrValue.length > 0) ? defaultAttrValue : module.settings.defaultSecondDropdownValue;

                if (!!redirectListValue && redirectListValue != defaultAttrValue && redirectListValue.length > 0) {
                    moduleObj.analytics.trackReportChange(module);
                    module.$actionButton.removeClass(module.settings.hideShowToggleClass);
                    module.$actionButton.attr("href", redirectListValue);
                } else {
                    module.$actionButton.addClass(module.settings.hideShowToggleClass);
                }
            }),

            changedProductType: mo.event(function (module, event) {
                event.preventDefault();

                moduleObj.actions.repopulateRedirectList(module);
            })

        },

        resets: {
            resetRedirectList: function (module, shouldSeedDefault) {
                moduleObj.resets.resetActionButton(module);
                module.$redirectList.html("");

                if (document.activeElement == module.$redirectList[0]) {
                    module.$redirectList.blur();
                }

                moduleObj.disableDropdown(module, module.$redirectList);

                if (shouldSeedDefault == undefined && !shouldSeedDefault) {
                    var defaultOption = $("<option/>");

                    var defaultAttrValue = module.$redirectList.attr(module.settings.defaultSecondDropdownDataAttr);
                    defaultAttrValue = (!!defaultAttrValue && defaultAttrValue.length > 0) ? defaultAttrValue : module.settings.defaultSecondDropdownValue;

                    defaultOption.html(defaultAttrValue);

                    module.$redirectList.append(defaultOption);
                }
            },

            resetActionButton: function (module) {
                module.$actionButton.addClass(module.settings.hideShowToggleClass);
            }
        },

        actions: {

            repopulateRedirectList: function (module) {
                moduleObj.resets.resetRedirectList(module, false);

                var productId = module.$productList.val();

                if (!!productId && productId.length > 0) {
                    var apiUrl = module.settings.apiUrl;
                    if (window.location.search) {
                        apiUrl += window.location.search;
                    }
                    $.get(apiUrl, {
                        pageId: module.$hiddenPageId.val(),
                        blockId: module.$hiddenBlockId.val(),
                        productId: module.$productList.val()
                    }, function (data, responseStatus) {
                        if (responseStatus == "success") {
                            if (!!data.Items && data.Items.length > 0) {
                                moduleObj.resets.resetRedirectList(module);

                                moduleObj.analytics.trackProductChange(module);

                                moduleObj.enableDropdown(module, module.$redirectList);

                                _.each(data.Items, function (redirectOption, redirectOptionIndex) {
                                    var newOption = $("<option/>");

                                    newOption.html(redirectOption.Text);
                                    newOption.val(redirectOption.Value);

                                    module.$redirectList.append(newOption);

                                    if (redirectOptionIndex == 0) {
                                        module.$redirectList.trigger(module.settings.listChangeEvent);
                                    }
                                });
                            }
                        }
                    });
                }
            }

        },

        disableDropdown: function (module, $element) {
            $element.addClass(module.settings.disabledClass);
            $element.prop("disabled", true);
        },

        enableDropdown: function (module, $element) {
            $element.removeClass(module.settings.disabledClass);
            $element.prop("disabled", false);
        },
    });

})();;
(function () {
    "use strict";


    var moduleObj = moduler('financialProfessionalsFormsDownloadByProduct', _({
        data: {

        },

        defaults: {
            categorySelectorContainer: '[data-section=CategorySelectorContainer]',
            categorySelectorArea: '[data-section=CategorySelectorArea]',
            categorySelectorTemplate: '[data-template=CategorySelectorItem]',

            subcategorySelectorContainer: '[data-section=SubCategorySelectorContainer]',
            subcategorySelectorArea: '[data-section=SubCategorySelectorArea]',
            subcategorySelectorTemplate: '[data-template=SubCategorySelectorItem]',

            productSelectorContainer: '[data-section=ProductSelectorContainer]',
            productSelectorArea: '[data-section=ProductSelectorArea]',
            productSelectorTemplate: '[data-template=ProductSelectorItem]',

            stateDropdownOptionArea: '[data-section=StateDropdownOptionArea]',
            stateDropdownOptionItemTemplate: '[data-template=StateDropdownOption]',
            stateDropdownDefaultOptionItemTemplate: '[data-template=StateDropdownDefaultOption]',

            requiredFormsCategoryTemplate: '[data-template=RequiredFormsCategory]',
            optionalFormsCategoryTemplate: '[data-template=OptionalFormsCategory]',
            serviceFormsCategoryTemplate: '[data-template=ServiceFormsCategory]',
            formsCategoryItemTemplate: '[data-template=FormCategoryOption]',

            formsArea: '[data-section=FormsArea]',

            downloadSummaryArea: '[data-section=DownloadSummaryArea]',
            singleDownloadAreaTemplate: '[data-template=SingleDownloadAreaTemplate]',
            multiDownloadAreaTemplate: '[data-template=MultiDownloadAreaTemplate]',
            multiDownloadAreaItemTemplate: '[data-template=MultiDownloadAreaItemTemplate]',

            disabledClass: 'Box--disabled',
            hideShowToggleClass: 'u-hiddenVisually',
            stateDefaultOptionValue: "NO_STATE_SELECTED",

            // URL Args
            stateUrlArg: "state",
            categoryUrlArg: "category",
            subcategoryUrlArg: "subcategory",
            productUrlArg: "product",


            // Forms Download URL 
            // TODO: Get From Server
            formsUrlDownloadBase: '/GetForms/',
        },

        init: function (module) {

            module.$categorySelectorContainer = module.$element.find(module.settings.categorySelectorContainer);
            module.$categorySelectorArea = module.$element.find(module.settings.categorySelectorArea);
            module.$categorySelectorTemplate = $(module.settings.categorySelectorTemplate);

            module.$subcategorySelectorContainer = module.$element.find(module.settings.subcategorySelectorContainer);
            module.$subcategorySelectorArea = module.$element.find(module.settings.subcategorySelectorArea);
            module.$subcategorySelectorTemplate = $(module.settings.subcategorySelectorTemplate);

            module.$productSelectorContainer = module.$element.find(module.settings.productSelectorContainer);
            module.$productSelectorArea = module.$element.find(module.settings.productSelectorArea);
            module.$productSelectorTemplate = $(module.settings.productSelectorTemplate);

            module.$stateDropdownOptionArea = module.$element.find(module.settings.stateDropdownOptionArea);

            module.$requiredFormsCategoryTemplate = $(module.settings.requiredFormsCategoryTemplate);
            module.$optionalFormsCategoryTemplate = $(module.settings.optionalFormsCategoryTemplate);
            module.$serviceFormsCategoryTemplate = $(module.settings.serviceFormsCategoryTemplate);
            module.$formsCategoryItemTemplate = $(module.settings.formsCategoryItemTemplate);

            module.$formsArea = module.$element.find(module.settings.formsArea);

            module.$downloadSummaryArea = module.$element.find(module.settings.downloadSummaryArea);
            module.$singleDownloadAreaTemplate = $(module.settings.singleDownloadAreaTemplate);
            module.$multiDownloadAreaTemplate = $(module.settings.multiDownloadAreaTemplate);
            module.$multiDownloadAreaItemTemplate = $(module.settings.multiDownloadAreaItemTemplate);

            $(document).on("click", ".Modal--wide .email-forms-submit-button", module, moduleObj.analytics.trackFormEmailEvent);

            moduleObj.actions.initializeOptions(module);

        },

        // TODO: Refactor reused Event Category
        analytics: {
            getTypePrefix: function (module) {
                return module.$element.data("block-type") + " ";
            },

            trackStateChange: function (module) {
                var state = moduleObj.data.selections.state;

                if (!!state && typeof gtag !== 'undefined') {
                    gtag('event', 'Select State', {
                        'event_category': moduleObj.analytics.getTypePrefix(module) + 'Form Download [By Product]',
                        'event_label': state.name + " [" + state.guid + "]"
                    });
                }
            },

            trackProductCategoryChange: function (module) {
                var category = moduleObj.data.selections.category;

                if (!!category && typeof gtag !== 'undefined') {
                    gtag('event', 'Select Product Category', {
                        'event_category': moduleObj.analytics.getTypePrefix(module) + 'Form Download [By Product]',
                        'event_label': category.name + " [" + category.guid + "]"
                    });
                }
            },

            trackProductSubcategoryChange: function (module) {
                var subcategory = moduleObj.data.selections.subcategory;

                if (!!subcategory && typeof gtag !== 'undefined') {
                    gtag('event', 'Select Product Subcategory', {
                        'event_category': moduleObj.analytics.getTypePrefix(module) + 'Form Download [By Product]',
                        'event_label': subcategory.name + " [" + subcategory.guid + "]"
                    });
                }
            },

            trackProductChange: function (module) {
                var product = moduleObj.data.selections.product;

                if (!!product && typeof gtag !== 'undefined') {
                    gtag('event', 'Select Product', {
                        'event_category': moduleObj.analytics.getTypePrefix(module) + 'Form Download [By Product]',
                        'event_label': product.name + " [" + product.guid + "]"
                    });
                }
            },

            trackFormDownloadEvent: mo.event(function (module, event) {
                if (typeof gtag !== 'undefined' && !!moduleObj.data.selections.selectedFormIds && moduleObj.data.selections.selectedFormIds.length > 0) {
                    gtag('event', 'Download Form(s)', {
                        'event_category': moduleObj.analytics.getTypePrefix(module) + 'Form Download [By Product]',
                        'event_label': moduleObj.data.selections.selectedFormIds
                    });
                }
            }),

            trackFormEmailEvent: mo.event(function (module, event) {
                if (typeof gtag !== 'undefined' && !!moduleObj.data.selections.selectedFormIds && moduleObj.data.selections.selectedFormIds.length > 0) {
                    gtag('event', 'Emailed Form(s)', {
                        'event_category': moduleObj.analytics.getTypePrefix(module) + 'Form Download [By Product]',
                        'event_label': moduleObj.data.selections.selectedFormIds
                    });
                }
            })
        },

        listen: {
            changedStateOption: mo.event(function (module, event) {
                var $currentTarget = $(event.currentTarget);
                var stateGuid = $currentTarget.val();

                if (stateGuid != null && stateGuid != module.settings.stateDefaultOptionValue) {
                    moduleObj.data.selections.state = _(moduleObj.data.states).findWhere({ guid: stateGuid });

                    moduleObj.shared.updateUrlHash(moduleObj.data.selections);

                    moduleObj.analytics.trackStateChange(module);

                    moduleObj.actions.setupCategories(module);
                } else {
                    moduleObj.actions.resetCategories(module);

                    moduleObj.shared.updateUrlHash(undefined);

                    module.$categorySelectorContainer.addClass(module.settings.disabledClass);
                }
            }),

            changedCategoryOption: mo.event(function (module, event) {
                var $currentTarget = $(event.currentTarget);
                var categoryGuid = $currentTarget.val();

                if (!!categoryGuid) {
                    moduleObj.data.selections.category = _(moduleObj.data.productCategories).findWhere({ guid: categoryGuid });

                    moduleObj.shared.updateUrlHash(moduleObj.data.selections);

                    moduleObj.analytics.trackProductCategoryChange(module);

                    moduleObj.actions.setupSubCategories(module);
                }
            }),

            changedSubCategoryOption: mo.event(function (module, event) {
                var $currentTarget = $(event.currentTarget);
                var subcategoryGuid = $currentTarget.val();

                if (!!subcategoryGuid) {
                    moduleObj.data.selections.subcategory = _(moduleObj.data.selections.category.terms).findWhere({ guid: subcategoryGuid });

                    moduleObj.shared.updateUrlHash(moduleObj.data.selections);

                    moduleObj.analytics.trackProductSubcategoryChange(module);

                    moduleObj.actions.setupProducts(module);
                }
            }),

            changedProductOption: mo.event(function (module, event) {
                var $currentTarget = $(event.currentTarget);
                var productGuid = $currentTarget.val();

                if (!!productGuid) {
                    moduleObj.data.selections.product = _(moduleObj.data.selections.subcategory.terms).findWhere({ guid: productGuid });

                    moduleObj.analytics.trackProductChange(module);

                    moduleObj.shared.updateUrlHash(moduleObj.data.selections);

                    moduleObj.data.selections.applicableForms = moduleObj.shared.getApplicableFormsForSelections(moduleObj.data.forms, moduleObj.data.productCategories, moduleObj.data.productOfferings, moduleObj.data.selections.state.guid, moduleObj.data.selections.subcategory.guid, undefined, moduleObj.data.selections.category.guid, moduleObj.data.selections.product.guid);

                    moduleObj.actions.setupFormsArea(module);
                }
            }),

            changedFormSelections: mo.event(function (module, event) {
                var $currentTarget = $(event.currentTarget);

                // Active Class Wrapper
                if ($currentTarget.prop("checked")) {
                    $currentTarget.siblings(".FormsDownload-label").addClass("is-active");
                } else {
                    $currentTarget.siblings(".FormsDownload-label").removeClass("is-active");
                }

                var selectedFormOptions = module.$formsArea.find("[data-form-id]:checked");

                moduleObj.data.selections.selectedFormAudiencePairs = _(selectedFormOptions).map(function (selectedFormCheckbox) {
                    var $selectedFormCheckbox = $(selectedFormCheckbox);
                    var formId = $selectedFormCheckbox.data("form-id");
                    var audienceId = $selectedFormCheckbox.data("audience-id");
                    var form = _(moduleObj.data.forms).findWhere({ formId: formId.toString() });

                    var selectedAudience = _(form.formAudiencesObjects).findWhere({ guid: audienceId });

                    return {
                        form: form,
                        audience: selectedAudience
                    };
                });

                moduleObj.actions.setupDownloadSummary(module);
            }),

            clickedEmailFormModal: mo.event(function (module, event) {
                var $formPanel = $(".email-forms-modal", module.$element);

                $("[data-bind=email-form-formids]").val(moduleObj.data.selections.selectedFormIds);
                
                var $emailFormSummaryList = $("[data-section=EmailFormsList]");

                var $generatedListSummaryItems = _.map(moduleObj.data.selections.selectedForms, function (form) {
                    var encodedFormIds = encodeURIComponent(form.formId);
                    var formDownloadUrl = module.settings.formsUrlDownloadBase + '?ids=' + encodedFormIds;

                    var $li = $("<li>");

                    var $link = $("<a>");

                    $link.attr("href", formDownloadUrl);
                    $link.text(form.documentTitle);

                    $li.append($link);

                    return $li;
                });

                $emailFormSummaryList.append($generatedListSummaryItems);
            }),
        },

        fn: {

        },

        actions: {
            initializeOptions: function (module) {
                var pageId = module.$element.data("page-id");
                var blockId = module.$element.data("block-id");

                moduleObj.shared.parseWidgetDataFromJson(pageId, blockId).then(function (blockData) {
                    moduleObj.data = blockData;

                    moduleObj.actions.registerChangeEvents(module);

                    moduleObj.actions.setupStates(module);

                    moduleObj.shared.seedTabFromUrl(module);
                    moduleObj.actions.seedFromUrl(module);
                });
            },

            seedFromUrl: function (module) {
                var hashState = moduleObj.shared.getHashValue(module.settings.stateUrlArg);
                var hashCategory = moduleObj.shared.getHashValue(module.settings.categoryUrlArg);
                var hashSubcategory = moduleObj.shared.getHashValue(module.settings.subcategoryUrlArg);
                var hashProduct = moduleObj.shared.getHashValue(module.settings.productUrlArg);

                // Nesting these because you cannot select a category without a state, etc etc
                if (!!hashState) {
                    module.$stateDropdownOptionArea.val(hashState);
                    module.$stateDropdownOptionArea.trigger("change");

                    if (!!hashCategory) {
                        module.$categorySelectorArea.val(hashCategory);
                        module.$categorySelectorArea.trigger("change");

                        if (!!hashSubcategory) {
                            module.$subcategorySelectorArea.val(hashSubcategory);
                            module.$subcategorySelectorArea.trigger("change");

                            if (!!hashProduct) {
                                module.$productSelectorArea.val(hashProduct);
                                module.$productSelectorArea.trigger("change");
                            }
                        }
                    }
                }
            },

            setupStates: function (module) {
                moduleObj.actions.resetStates(module);

                module.$stateDropdownOptionArea.trigger("change");
            },

            setupCategories: function (module) {
                // Data for categories
                var categories = moduleObj.data.productCategories;

                // Remove options without forms associated
                categories = _(categories).chain().filter(function (categoryToFilter) {
                    return moduleObj.shared.getApplicableFormsForSelections(moduleObj.data.forms, moduleObj.data.productCategories, moduleObj.data.productOfferings, moduleObj.data.selections.state.guid, undefined, undefined, categoryToFilter.guid).length > 0;
                }).sortBy("name").value();

                moduleObj.actions.resetCategories(module);

                for (var x = 0; x < categories.length; x++) {
                    var categorySelectionOptionTemplate = moduleObj.actions.getTemplateFromElement(module.$categorySelectorTemplate);

                    categorySelectionOptionTemplate = categorySelectionOptionTemplate.replace(/\{0\}/g, categories[x].guid);
                    categorySelectionOptionTemplate = categorySelectionOptionTemplate.replace(/\{1\}/g, categories[x].name);

                    var checkedString = (moduleObj.data.selections.category == categories[x]) ? "checked" : undefined;
                    categorySelectionOptionTemplate = categorySelectionOptionTemplate.replace(/\{2\}/g, checkedString);

                    module.$categorySelectorArea.append(categorySelectionOptionTemplate);
                }

                module.$categorySelectorContainer.removeClass(module.settings.disabledClass);
            },

            setupSubCategories: function (module) {
                var subcategories = moduleObj.data.selections.category.terms;

                // Remove options without forms associated
                //subcategories = _(subcategories).chain().filter(function (subcategoryToFilter) {
                //    return moduleObj.shared.getApplicableFormsForSelections(moduleObj.data.forms, moduleObj.data.productCategories, moduleObj.data.productOfferings, moduleObj.data.selections.state.guid, subcategoryToFilter.guid, undefined, moduleObj.data.selections.category.guid).length > 0;
                //}).sortBy("name").value();
                subcategories = _(subcategories).chain().filter(function (subcategoryToFilter) {
                    return _.any(subcategoryToFilter.terms, function (productTerm) {
                        return moduleObj.shared.getApplicableFormsForSelections(moduleObj.data.forms, moduleObj.data.productCategories, moduleObj.data.productOfferings, moduleObj.data.selections.state.guid, subcategoryToFilter.guid, undefined, moduleObj.data.selections.category.guid, productTerm.guid).length > 0;
                    });
                }).sortBy("name").value();

                moduleObj.actions.resetSubCategories(module);

                for (var x = 0; x < subcategories.length; x++) {
                    var categorySelectionOptionTemplate = moduleObj.actions.getTemplateFromElement(module.$subcategorySelectorTemplate);

                    categorySelectionOptionTemplate = categorySelectionOptionTemplate.replace(/\{0\}/g, subcategories[x].guid);
                    categorySelectionOptionTemplate = categorySelectionOptionTemplate.replace(/\{1\}/g, subcategories[x].name);

                    var checkedString = (moduleObj.data.selections.subcategory == subcategories[x]) ? "checked" : undefined;
                    categorySelectionOptionTemplate = categorySelectionOptionTemplate.replace(/\{2\}/g, checkedString);

                    module.$subcategorySelectorArea.append(categorySelectionOptionTemplate);
                }

                module.$subcategorySelectorContainer.removeClass(module.settings.disabledClass);
            },

            setupProducts: function (module) {
                var products = moduleObj.data.selections.subcategory.terms;

                // Remove options without forms associated
                products = _(products).chain().filter(function (productToFilter) {
                    return moduleObj.shared.getApplicableFormsForSelections(moduleObj.data.forms, moduleObj.data.productCategories, moduleObj.data.productOfferings, moduleObj.data.selections.state.guid, moduleObj.data.selections.subcategory.guid, undefined, moduleObj.data.selections.category.guid, productToFilter.guid).length > 0;
                }).sortBy("name").value();

                moduleObj.actions.resetProductOptions(module);

                for (var x = 0; x < products.length; x++) {
                    var itemTemplate = moduleObj.actions.getTemplateFromElement(module.$productSelectorTemplate);

                    itemTemplate = itemTemplate.replace(/\{0\}/g, products[x].guid);
                    itemTemplate = itemTemplate.replace(/\{1\}/g, products[x].name);

                    var checkedString = (moduleObj.data.selections.product == products[x]) ? "checked" : undefined;
                    itemTemplate = itemTemplate.replace(/\{2\}/g, checkedString);

                    module.$productSelectorArea.append(itemTemplate);
                }

                module.$productSelectorContainer.removeClass(module.settings.disabledClass);
            },

            getApplicableFormsForCategory: function (module, allForms, formAudienceRegex) {
                return _(allForms).chain().filter(function (applicableForm) {
                    return _(applicableForm.formAudiencesObjects).some(function (formAudience) {
                        return !!formAudience.actionType.match(formAudienceRegex);
                    });
                }).sortBy("documentTitle").value();
            },

            getFormCategoryOptions: function (module, applicableForms, formActionTypeId) {

                var fillableIcon = '<img src="/Assets/Images/tooltip.gif" class="Tooltip" title="This form can be filled out electronically using Adobe Acrobat." />';


                var subItemTemplates = _(applicableForms).map(function (applicableForm, applicableFormIndex) {
                    var subitemTemplate = moduleObj.actions.getTemplateFromElement(module.$formsCategoryItemTemplate);

                    subitemTemplate = subitemTemplate.replace(/\{0\}/g, formActionTypeId); // Hardcoded index for required
                    subitemTemplate = subitemTemplate.replace(/\{1\}/g, applicableFormIndex);
                    subitemTemplate = subitemTemplate.replace(/\{3\}/g, applicableForm.formId);
                    subitemTemplate = subitemTemplate.replace(/\{4\}/g, 1);

                    if (!!applicableForm.fillable) {
                        subitemTemplate = subitemTemplate.replace(/\{2\}/g, applicableForm.documentTitle + fillableIcon);
                    } else {
                        subitemTemplate = subitemTemplate.replace(/\{2\}/g, applicableForm.documentTitle);
                    }

                    return subitemTemplate;

                });

                return subItemTemplates.join("");

            },

            setupFormsArea: function (module) {
                var allApplicableForms = moduleObj.data.selections.applicableForms;

                moduleObj.actions.resetFormsArea(module);

                // Three Areas:
                // 1. Required
                // 2. Optional
                // 3. Service

                // Required
                var formsForCategory = moduleObj.actions.getApplicableFormsForCategory(module, allApplicableForms, /required/i);
                var partialFormsHtml = moduleObj.actions.getFormCategoryOptions(module, formsForCategory, 0);

                if (partialFormsHtml.length > 0) {
                    var itemTemplate = moduleObj.actions.getTemplateFromElement(module.$requiredFormsCategoryTemplate);

                    itemTemplate = itemTemplate.replace(/\{0\}/g, partialFormsHtml); // No comma separated list of children options

                    // URL for all required products
                    var formIds = _(formsForCategory).pluck("formId");
                    var encodedFormIds = encodeURIComponent(formIds.join(","));
                    var formDownloadUrl = module.settings.formsUrlDownloadBase + '?ids=' + encodedFormIds;

                    itemTemplate = itemTemplate.replace(/\{1\}/g, formDownloadUrl);

                    module.$formsArea.append(itemTemplate);

                }

                // Setup Download All


                // Optional
                formsForCategory = moduleObj.actions.getApplicableFormsForCategory(module, allApplicableForms, /optional/i);
                partialFormsHtml = moduleObj.actions.getFormCategoryOptions(module, formsForCategory, 1);

                if (partialFormsHtml.length > 0) {
                    var itemTemplate = moduleObj.actions.getTemplateFromElement(module.$optionalFormsCategoryTemplate);

                    itemTemplate = itemTemplate.replace(/\{0\}/g, partialFormsHtml); // No comma separated list of children options

                    module.$formsArea.append(itemTemplate);

                }

                // Service
                formsForCategory = moduleObj.actions.getApplicableFormsForCategory(module, allApplicableForms, /service/i);
                partialFormsHtml = moduleObj.actions.getFormCategoryOptions(module, formsForCategory, 2);

                if (partialFormsHtml.length > 0) {
                    var itemTemplate = moduleObj.actions.getTemplateFromElement(module.$serviceFormsCategoryTemplate);

                    itemTemplate = itemTemplate.replace(/\{0\}/g, partialFormsHtml); // No comma separated list of children options

                    module.$formsArea.append(itemTemplate);
                    $('.Tooltip').tooltipster({
                        maxWidth: 260,
                        position: "right"
                    });
                }
            },

            setupDownloadSummary: function (module) {
                var selectedFormAudiencePairs = moduleObj.data.selections.selectedFormAudiencePairs;

                moduleObj.actions.resetDownloadSummary(module);

                if (selectedFormAudiencePairs.length > 0) {
                    var selectedForms = _(selectedFormAudiencePairs).pluck("form");

                    moduleObj.data.selections.selectedForms = selectedForms;

                    var formIds = _(selectedForms).pluck("formId");

                    var joinedFormIds = formIds.join(",");
                    moduleObj.data.selections.selectedFormIds = joinedFormIds;

                    var encodedFormIds = encodeURIComponent(joinedFormIds);
                    var formDownloadUrl = module.settings.formsUrlDownloadBase + '?ids=' + encodedFormIds;

                    if (selectedFormAudiencePairs.length == 1) {
                        var selectedFormAudiencePair = selectedFormAudiencePairs[0];

                        var templateHtml = moduleObj.actions.getTemplateFromElement(module.$singleDownloadAreaTemplate);

                        templateHtml = templateHtml.replace(/\{0\}/g, selectedFormAudiencePair.form.documentTitle);
                        templateHtml = templateHtml.replace(/\{1\}/g, selectedFormAudiencePair.form.formNumber);

                        if (!!selectedFormAudiencePair.form.documentDescription) {
                            templateHtml = templateHtml.replace(/\{2\}/g, selectedFormAudiencePair.form.documentDescription);
                        } else {
                            templateHtml = templateHtml.replace(/\{2\}/g, "");
                        }

                        templateHtml = templateHtml.replace(/\{3\}/g, formDownloadUrl);

                        module.$downloadSummaryArea.append(templateHtml);
                    } else {
                        var templateHtml = moduleObj.actions.getTemplateFromElement(module.$multiDownloadAreaTemplate);

                        var subitemTemplates = "";

                        _(selectedFormAudiencePairs).each(function (selectedFormAudiencePair) {
                            var itemTemplateHtml = moduleObj.actions.getTemplateFromElement(module.$multiDownloadAreaItemTemplate);

                            itemTemplateHtml = itemTemplateHtml.replace(/\{0\}/g, selectedFormAudiencePair.form.documentTitle);

                            subitemTemplates = subitemTemplates + itemTemplateHtml;
                        });

                        templateHtml = templateHtml.replace(/\{0\}/g, subitemTemplates);
                        templateHtml = templateHtml.replace(/\{1\}/g, formDownloadUrl);

                        module.$downloadSummaryArea.append(templateHtml);
                    }
                }
            },

            resetStates: function (module) {
                moduleObj.actions.resetCategories(module);
            },

            resetCategories: function (module) {
                module.$categorySelectorArea.empty();

                moduleObj.actions.resetSubCategories(module);
            },

            resetSubCategories: function (module) {
                module.$subcategorySelectorArea.empty();
                module.$subcategorySelectorContainer.addClass(module.settings.disabledClass);

                moduleObj.actions.resetProductOptions(module);
            },

            resetProductOptions: function (module) {
                module.$productSelectorArea.empty();
                module.$productSelectorContainer.addClass(module.settings.disabledClass);

                moduleObj.actions.resetFormsArea(module);
            },

            resetFormsArea: function (module) {
                module.$formsArea.empty();

                moduleObj.actions.resetDownloadSummary(module);
            },

            resetDownloadSummary: function (module) {
                module.$downloadSummaryArea.empty();
            },

            registerChangeEvents: function (module) {
                module.$stateDropdownOptionArea.on("change", module, moduleObj.listen.changedStateOption); // module.$stateDropdownOptionArea
                module.$categorySelectorArea.on("change", module, moduleObj.listen.changedCategoryOption); // module.$categorySelectorArea
                module.$subcategorySelectorArea.on("change", module, moduleObj.listen.changedSubCategoryOption); // module.$subcategorySelectorArea
                module.$productSelectorArea.on("change", module, moduleObj.listen.changedProductOption); // module.$productSelectorArea
                module.$formsArea.on("change", "[data-form-id]", module, moduleObj.listen.changedFormSelections);
                module.$element.on("click", "[data-modal].email-forms-button", module, moduleObj.listen.clickedEmailFormModal);
                module.$element.on("click", ".download-forms-button", module, moduleObj.analytics.trackFormDownloadEvent);
            },

            getTemplateFromElement: function ($element) {
                var elementHtml = $element.html();
                elementHtml = elementHtml.trim();

                return elementHtml;
            },
        }
    }).extend(symetra.formDownloadModuleBase));

})();;
(function () {
    "use strict";

    var moduleObj = moduler('financialProfessionalsFormsDownloadByTransactionType', _({
        data: {

        },

        defaults: {
            transactionTypeSelectorContainer: '[data-section=TransactionTypeSelectorContainer]',
            transactionTypeSelectorArea: '[data-section=TransactionTypeSelectorArea]',
            transactionTypeSelectorItemTemplate: '[data-template=TransactionTypeSelectorItem]',

            categorySelectorContainer: '[data-section=CategorySelectorContainer]',
            categorySelectorArea: '[data-section=CategorySelectorArea]',
            categorySelectorTemplate: '[data-template=CategorySelectorItem]',

            productSelectorContainer: '[data-section=ProductSelectorContainer]',
            productSelectorArea: '[data-section=ProductSelectorArea]',
            productSelectorTemplate: '[data-template=ProductSelectorItem]',

            stateDropdownOptionArea: '[data-section=StateDropdownOptionArea]',
            stateDropdownOptionItemTemplate: '[data-template=StateDropdownOption]',
            stateDropdownDefaultOptionItemTemplate: '[data-template=StateDropdownDefaultOption]',

            requiredFormsCategoryTemplate: '[data-template=RequiredFormsCategory]',
            optionalFormsCategoryTemplate: '[data-template=OptionalFormsCategory]',
            serviceFormsCategoryTemplate: '[data-template=ServiceFormsCategory]',
            formsCategoryItemTemplate: '[data-template=FormCategoryOption]',

            formsArea: '[data-section=FormsArea]',

            downloadSummaryArea: '[data-section=DownloadSummaryArea]',
            singleDownloadAreaTemplate: '[data-template=SingleDownloadAreaTemplate]',
            multiDownloadAreaTemplate: '[data-template=MultiDownloadAreaTemplate]',
            multiDownloadAreaItemTemplate: '[data-template=MultiDownloadAreaItemTemplate]',

            disabledClass: 'Box--disabled',
            hideShowToggleClass: 'u-hiddenVisually',
            stateDefaultOptionValue: "NO_STATE_SELECTED",

            // URL Args
            stateUrlArg: "state",
            categoryUrlArg: "category",
            transactionTypeUrlArg: "transaction",
            productUrlArg: "product",


            // Forms Download URL 
            // TODO: Get From Server
            formsUrlDownloadBase: '/GetForms/',
        },

        init: function (module) {
            module.$categorySelectorContainer = module.$element.find(module.settings.categorySelectorContainer);
            module.$categorySelectorArea = module.$element.find(module.settings.categorySelectorArea);
            module.$categorySelectorTemplate = $(module.settings.categorySelectorTemplate);

            module.$transactionTypeSelectorContainer = module.$element.find(module.settings.transactionTypeSelectorContainer);
            module.$transactionTypeSelectorArea = module.$element.find(module.settings.transactionTypeSelectorArea);
            module.$transactionTypeSelectorItemTemplate = $(module.settings.transactionTypeSelectorItemTemplate);

            module.$productSelectorContainer = module.$element.find(module.settings.productSelectorContainer);
            module.$productSelectorArea = module.$element.find(module.settings.productSelectorArea);
            module.$productSelectorTemplate = $(module.settings.productSelectorTemplate);

            module.$stateDropdownOptionArea = module.$element.find(module.settings.stateDropdownOptionArea);

            module.$requiredFormsCategoryTemplate = $(module.settings.requiredFormsCategoryTemplate);
            module.$optionalFormsCategoryTemplate = $(module.settings.optionalFormsCategoryTemplate);
            module.$serviceFormsCategoryTemplate = $(module.settings.serviceFormsCategoryTemplate);
            module.$formsCategoryItemTemplate = $(module.settings.formsCategoryItemTemplate);

            module.$formsArea = module.$element.find(module.settings.formsArea);

            module.$downloadSummaryArea = module.$element.find(module.settings.downloadSummaryArea);
            module.$singleDownloadAreaTemplate = $(module.settings.singleDownloadAreaTemplate);
            module.$multiDownloadAreaTemplate = $(module.settings.multiDownloadAreaTemplate);
            module.$multiDownloadAreaItemTemplate = $(module.settings.multiDownloadAreaItemTemplate);

            $(document).on("click", ".Modal--wide .email-forms-submit-button", module, moduleObj.analytics.trackFormEmailEvent);

            moduleObj.actions.initializeOptions(module);
        },

        // TODO: Refactor reused Event Category
        analytics: {
            getTypePrefix: function (module) {
                return module.$element.data("block-type") + " ";
            },

            trackStateChange: function (module) {
                var state = moduleObj.data.selections.state;

                if (typeof gtag !== 'undefined' && !!state) {
                    gtag('event', 'Select State', {
                        'event_category': moduleObj.analytics.getTypePrefix(module) + 'Form Download [By Transaction Type]',
                        'event_label': state.name + " [" + state.guid + "]"
                    });
                }
            },

            trackProductCategoryChange: function (module) {
                var category = moduleObj.data.selections.category;

                if (typeof gtag !== 'undefined' && !!category) {
                    gtag('event', 'Select Product Category', {
                        'event_category': moduleObj.analytics.getTypePrefix(module) + 'Form Download [By Transaction Type]',
                        'event_label': category.name + " [" + category.guid + "]"
                    });
                }
            },

            trackProductSubcategoryChange: function (module) {
                var subcategory = moduleObj.data.selections.subcategory;

                if (typeof gtag !== 'undefined' && !!subcategory) {
                    gtag('event', 'Select Product Subcategory', {
                        'event_category': moduleObj.analytics.getTypePrefix(module) + 'Form Download [By Transaction Type]',
                        'event_label': subcategory.name + " [" + subcategory.guid + "]"
                    });
                }
            },


            trackProductChange: function (module) {
                var product = moduleObj.data.selections.product;

                if (typeof gtag !== 'undefined' && !!product) {
                    gtag('event', 'Select Product', {
                        'event_category': moduleObj.analytics.getTypePrefix(module) + 'Form Download [By Transaction Type]',
                        'event_label': product.name + " [" + product.guid + "]"
                    });
                }
            },

            trackTransactionTypeChange: function (module) {
                var formWebAudience = moduleObj.data.selections.formWebAudience;

                if (typeof gtag !== 'undefined' && !!formWebAudience) {
                    gtag('event', 'Select Transaction Type', {
                        'event_category': moduleObj.analytics.getTypePrefix(module) + 'Form Download [By Transaction Type]',
                        'event_label': formWebAudience.name + " [" + formWebAudience.guid + "]"
                    });
                }
            },

            trackFormDownloadEvent: mo.event(function (module, event) {
                if (typeof gtag !== 'undefined' && !!moduleObj.data.selections.selectedFormIds && moduleObj.data.selections.selectedFormIds.length > 0) {
                    gtag('event', 'Download Form(s)', {
                        'event_category': moduleObj.analytics.getTypePrefix(module) + 'Form Download [By Transaction Type]',
                        'event_label': moduleObj.data.selections.selectedFormIds
                    });
                }
            }),

            trackFormEmailEvent: mo.event(function (module, event) {
                if (typeof gtag !== 'undefined' && !!moduleObj.data.selections.selectedFormIds && moduleObj.data.selections.selectedFormIds.length > 0) {
                    gtag('event', 'Emailed Form(s)', {
                        'event_category': moduleObj.analytics.getTypePrefix(module) + 'Form Download [By Transaction Type]',
                        'event_label': moduleObj.data.selections.selectedFormIds
                    });
                }
            })
        },

        listen: {

            changedStateOption: mo.event(function (module, event) {
                var $currentTarget = $(event.currentTarget);
                var stateGuid = $currentTarget.val();

                if (stateGuid != null && stateGuid != module.settings.stateDefaultOptionValue) {
                    moduleObj.data.selections.state = _(moduleObj.data.states).findWhere({ guid: stateGuid });

                    moduleObj.analytics.trackStateChange(module);

                    moduleObj.actions.setupTransactionTypes(module);
                } else {
                    moduleObj.actions.resetTransactionTypes(module);
                    module.$transactionTypeSelectorContainer.addClass(module.settings.disabledClass);
                }
            }),

            changedCategoryOption: mo.event(function (module, event) {
                var $currentTarget = $(event.currentTarget);
                var selectedValue = $currentTarget.val();

                if (!!selectedValue) {
                    moduleObj.data.selections.category = _(moduleObj.data.productCategories).findWhere({ guid: selectedValue });

                    moduleObj.analytics.trackProductCategoryChange(module);

                    moduleObj.actions.setupProducts(module);
                }
            }),

            changedTransactionTypeOption: mo.event(function (module, event) {
                var $currentTarget = $(event.currentTarget);
                var selectedValue = $currentTarget.val();

                if (!!selectedValue) {
                    var selectedFormWebAudience = _(moduleObj.fn.getAllFormWebAudiences()).findWhere({ guid: selectedValue });

                    moduleObj.data.selections.formWebAudience = selectedFormWebAudience;

                    moduleObj.analytics.trackTransactionTypeChange(module);

                    moduleObj.actions.setupCategories(module);
                }
            }),

            changedProductOption: mo.event(function (module, event) {
                var $currentTarget = $(event.currentTarget);
                var selectedValue = $currentTarget.val();

                if (!!selectedValue) {
                    moduleObj.data.selections.product = _(moduleObj.data.selections.category.terms).chain().pluck("terms").flatten().findWhere({ guid: selectedValue }).value();

                    moduleObj.analytics.trackProductChange(module);

                    moduleObj.data.selections.applicableForms = moduleObj.shared.getApplicableFormsForSelections(moduleObj.data.forms, moduleObj.data.productCategories, moduleObj.data.productOfferings, moduleObj.data.selections.state.guid, undefined, moduleObj.data.selections.formWebAudience.actionName, moduleObj.data.selections.category.guid, moduleObj.data.selections.product.guid);

                    moduleObj.actions.setupFormsArea(module);
                }
            }),

            changedFormSelections: mo.event(function (module, event) {
                var $currentTarget = $(event.currentTarget);
                var selectedFormOptions = module.$formsArea.find("[data-form-id]:checked");

                moduleObj.data.selections.selectedFormAudiencePairs = _(selectedFormOptions).map(function (selectedFormCheckbox) {
                    var $selectedFormCheckbox = $(selectedFormCheckbox);
                    var formId = $selectedFormCheckbox.data("form-id");
                    var audienceId = $selectedFormCheckbox.data("audience-id");
                    var form = _(moduleObj.data.forms).findWhere({ formId: formId.toString() });

                    var selectedAudience = _(form.formAudiencesObjects).findWhere({ guid: audienceId });

                    return {
                        form: form,
                        audience: selectedAudience
                    };
                });

                moduleObj.actions.setupDownloadSummary(module);
            }),

            clickedEmailFormModal: mo.event(function (module, event) {
                var $formPanel = $(".email-forms-modal", module.$element);

                $("[data-bind=email-form-formids]").val(moduleObj.data.selections.selectedFormIds);

                var $emailFormSummaryList = $("[data-section=EmailFormsList]");

                var $generatedListSummaryItems = _.map(moduleObj.data.selections.selectedForms, function (form) {
                    var encodedFormIds = encodeURIComponent(form.formId);
                    var formDownloadUrl = module.settings.formsUrlDownloadBase + '?ids=' + encodedFormIds;

                    var $li = $("<li>");

                    var $link = $("<a>");

                    $link.attr("href", formDownloadUrl);
                    $link.text(form.documentTitle);

                    $li.append($link);

                    return $li;
                });

                $emailFormSummaryList.append($generatedListSummaryItems);
            }),

        },

        fn: {

            getAllFormWebAudiences: function () {
                return _(moduleObj.data.forms).chain().pluck("formAudiencesObjects").flatten().value();
            },

            getUniqueFormWebAudiences: function () {
                return _(moduleObj.fn.getAllFormWebAudiences()).uniq(false, function (formWebAudience) {
                    return formWebAudience.actionName;
                });
            },

        },

        actions: {

            initializeOptions: function (module) {
                var pageId = module.$element.data("page-id");
                var blockId = module.$element.data("block-id");

                moduleObj.shared.parseWidgetDataFromJson(pageId, blockId).then(function (blockData) {
                    moduleObj.data = blockData;

                    moduleObj.actions.registerChangeEvents(module);

                    moduleObj.actions.setupStates(module);

                    moduleObj.shared.seedTabFromUrl(module);
                    moduleObj.actions.seedFromUrl(module);
                });
            },


            seedFromUrl: function (module) {
                var hashState = moduleObj.shared.getHashValue(module.settings.stateUrlArg);
                var hashTransactionType = moduleObj.shared.getHashValue(module.settings.transactionTypeUrlArg);
                var hashCategory = moduleObj.shared.getHashValue(module.settings.categoryUrlArg);
                var hashProduct = moduleObj.shared.getHashValue(module.settings.productUrlArg);

                if (!!hashState) {
                    module.$stateDropdownOptionArea.val(hashState);
                    module.$stateDropdownOptionArea.trigger("change");

                    if (!!hashTransactionType) {
                        module.$transactionTypeSelectorArea.val(hashTransactionType);
                        module.$transactionTypeSelectorArea.trigger("change");

                        if (!!hashCategory) {
                            module.$categorySelectorArea.val(hashCategory);
                            module.$categorySelectorArea.trigger("change");

                            if (!!hashProduct) {
                                module.$productSelectorArea.val(hashProduct);
                                module.$productSelectorArea.trigger("change");
                            }
                        }
                    }
                }
            },

            setupStates: function (module) {
                moduleObj.actions.resetStates(module);

                module.$stateDropdownOptionArea.trigger("change");
            },

            setupCategories: function (module) {
                // Data for categories
                var categories = moduleObj.data.productCategories;

                // Remove options without forms associated
                categories = _(categories).chain().filter(function (categoryToFilter) {
                    return moduleObj.shared.getApplicableFormsForSelections(moduleObj.data.forms, moduleObj.data.productCategories, moduleObj.data.productOfferings, moduleObj.data.selections.state.guid, undefined, moduleObj.data.selections.formWebAudience.actionName, categoryToFilter.guid).length > 0;
                }).sortBy("name").value();

                moduleObj.actions.resetCategories(module);

                for (var x = 0; x < categories.length; x++) {
                    var categorySelectionOptionTemplate = moduleObj.actions.getTemplateFromElement(module.$categorySelectorTemplate);

                    categorySelectionOptionTemplate = categorySelectionOptionTemplate.replace(/\{0\}/g, categories[x].guid);
                    categorySelectionOptionTemplate = categorySelectionOptionTemplate.replace(/\{1\}/g, categories[x].name);

                    var checkedString = (moduleObj.data.selections.category == categories[x]) ? "checked" : undefined;
                    categorySelectionOptionTemplate = categorySelectionOptionTemplate.replace(/\{2\}/g, checkedString);

                    module.$categorySelectorArea.append(categorySelectionOptionTemplate);
                }

                module.$categorySelectorContainer.removeClass(module.settings.disabledClass);
            },

            setupTransactionTypes: function (module) {
                var uniqueFormWebAudiences = moduleObj.fn.getUniqueFormWebAudiences();

                // Transaction names only
                var applicableFormWebAudiences = _(uniqueFormWebAudiences).chain().filter(function (formWebAudience) {
                    return moduleObj.shared.getApplicableFormsForSelections(moduleObj.data.forms, moduleObj.data.productCategories, moduleObj.data.productOfferings, moduleObj.data.selections.state.guid, undefined, formWebAudience.actionName).length > 0;
                }).sortBy("actionName").value();

                moduleObj.actions.resetTransactionTypes(module);

                for (var x = 0; x < applicableFormWebAudiences.length; x++) {
                    var itemTemplate = moduleObj.actions.getTemplateFromElement(module.$transactionTypeSelectorItemTemplate);

                    itemTemplate = itemTemplate.replace(/\{0\}/g, applicableFormWebAudiences[x].guid);
                    itemTemplate = itemTemplate.replace(/\{1\}/g, applicableFormWebAudiences[x].actionName);

                    itemTemplate = itemTemplate.replace(/\{2\}/g, undefined); // checked/selected

                    module.$transactionTypeSelectorArea.append(itemTemplate);
                }

                module.$transactionTypeSelectorContainer.removeClass(module.settings.disabledClass);
            },

            setupProducts: function (module) {
                var products = _(moduleObj.data.selections.category.terms).chain().pluck("terms").flatten().value(); // All children of all subcategories of selected category

                // Remove options without forms associated
                products = _(products).chain().filter(function (productToFilter) {
                    return moduleObj.shared.getApplicableFormsForSelections(moduleObj.data.forms, moduleObj.data.productCategories, moduleObj.data.productOfferings, moduleObj.data.selections.state.guid, undefined, moduleObj.data.selections.formWebAudience.actionName, moduleObj.data.selections.category.guid, productToFilter.guid).length > 0;
                }).sortBy("name").value();

                moduleObj.actions.resetProductOptions(module);

                for (var x = 0; x < products.length; x++) {
                    var itemTemplate = moduleObj.actions.getTemplateFromElement(module.$productSelectorTemplate);

                    itemTemplate = itemTemplate.replace(/\{0\}/g, products[x].guid);
                    itemTemplate = itemTemplate.replace(/\{1\}/g, products[x].name);

                    var checkedString = (moduleObj.data.selections.product == products[x]) ? "checked" : undefined;
                    itemTemplate = itemTemplate.replace(/\{2\}/g, checkedString);

                    module.$productSelectorArea.append(itemTemplate);
                }

                module.$productSelectorContainer.removeClass(module.settings.disabledClass);
            },

            getApplicableFormsForCategory: function (module, allForms, formAudienceRegex) {
                return _(allForms).chain().filter(function (applicableForm) {
                    return _(applicableForm.formAudiencesObjects).some(function (formAudience) {
                        return !!formAudience.actionType.match(formAudienceRegex);
                    });
                }).sortBy("documentTitle").value();
            },

            getFormCategoryOptions: function (module, applicableForms, formActionTypeId) {
                var fillableIcon = '<img src="/Assets/Images/tooltip.gif" class="Tooltip" title="This form can be filled out electronically using Adobe Acrobat." />';

                var subItemTemplates = _(applicableForms).map(function (applicableForm, applicableFormIndex) {
                    var subitemTemplate = moduleObj.actions.getTemplateFromElement(module.$formsCategoryItemTemplate);

                    subitemTemplate = subitemTemplate.replace(/\{0\}/g, formActionTypeId); // Hardcoded index for required
                    subitemTemplate = subitemTemplate.replace(/\{1\}/g, applicableFormIndex);
                    subitemTemplate = subitemTemplate.replace(/\{3\}/g, applicableForm.formId);
                    subitemTemplate = subitemTemplate.replace(/\{4\}/g, 0);

                    if (!!applicableForm.fillable) {
                        subitemTemplate = subitemTemplate.replace(/\{2\}/g, applicableForm.documentTitle + fillableIcon);
                    } else {
                        subitemTemplate = subitemTemplate.replace(/\{2\}/g, applicableForm.documentTitle);
                    }

                    return subitemTemplate;
                });

                return subItemTemplates.join("");
            },


            setupFormsArea: function (module) {
                var allApplicableForms = moduleObj.data.selections.applicableForms;

                moduleObj.actions.resetFormsArea(module);

                // Three Areas:
                // 1. Required
                // 2. Optional
                // 3. Service

                // Required
                var formsForCategory = moduleObj.actions.getApplicableFormsForCategory(module, allApplicableForms, /required/i);
                var partialFormsHtml = moduleObj.actions.getFormCategoryOptions(module, formsForCategory, 0);

                if (partialFormsHtml.length > 0) {
                    var itemTemplate = moduleObj.actions.getTemplateFromElement(module.$requiredFormsCategoryTemplate);

                    itemTemplate = itemTemplate.replace(/\{0\}/g, partialFormsHtml);

                    // URL for all required products
                    var formIds = _(formsForCategory).pluck("formId");
                    var encodedFormIds = encodeURIComponent(formIds.join(","));
                    var formDownloadUrl = module.settings.formsUrlDownloadBase + '?ids=' + encodedFormIds;

                    itemTemplate = itemTemplate.replace(/\{1\}/g, formDownloadUrl);

                    module.$formsArea.append(itemTemplate);
                   
                }

                // Optional
                formsForCategory = moduleObj.actions.getApplicableFormsForCategory(module, allApplicableForms, /optional/i);
                partialFormsHtml = moduleObj.actions.getFormCategoryOptions(module, formsForCategory, 1);

                if (partialFormsHtml.length > 0) {
                    var itemTemplate = moduleObj.actions.getTemplateFromElement(module.$optionalFormsCategoryTemplate);

                    itemTemplate = itemTemplate.replace(/\{0\}/g, partialFormsHtml);

                    module.$formsArea.append(itemTemplate);
                }

                // Service
                formsForCategory = moduleObj.actions.getApplicableFormsForCategory(module, allApplicableForms, /service/i);
                partialFormsHtml = moduleObj.actions.getFormCategoryOptions(module, formsForCategory, 2);

                if (partialFormsHtml.length > 0) {
                    var itemTemplate = moduleObj.actions.getTemplateFromElement(module.$serviceFormsCategoryTemplate);

                    itemTemplate = itemTemplate.replace(/\{0\}/g, partialFormsHtml);

                    module.$formsArea.append(itemTemplate);
                    $('.Tooltip').tooltipster({
                        maxWidth: 260,
                        position: "right"
                    });
                }
            },

            setupDownloadSummary: function (module) {
                var selectedFormAudiencePairs = moduleObj.data.selections.selectedFormAudiencePairs;

                moduleObj.actions.resetDownloadSummary(module);

                if (selectedFormAudiencePairs.length > 0) {
                    var selectedForms = _(selectedFormAudiencePairs).pluck("form");

                    moduleObj.data.selections.selectedForms = selectedForms;

                    var formIds = _(selectedForms).pluck("formId");
                    var joinedFormIds = formIds.join(",");

                    moduleObj.data.selections.selectedFormIds = joinedFormIds;

                    var encodedFormIds = encodeURIComponent(joinedFormIds);
                    var formDownloadUrl = module.settings.formsUrlDownloadBase + '?ids=' + encodedFormIds;

                    if (selectedFormAudiencePairs.length == 1) {
                        var selectedFormAudiencePair = selectedFormAudiencePairs[0];

                        var templateHtml = moduleObj.actions.getTemplateFromElement(module.$singleDownloadAreaTemplate);

                        templateHtml = templateHtml.replace(/\{0\}/g, selectedFormAudiencePair.form.documentTitle);
                        templateHtml = templateHtml.replace(/\{1\}/g, selectedFormAudiencePair.form.formNumber);

                        if (!!selectedFormAudiencePair.form.documentDescription) {
                            templateHtml = templateHtml.replace(/\{2\}/g, selectedFormAudiencePair.form.documentDescription);
                        } else {
                            templateHtml = templateHtml.replace(/\{2\}/g, "");
                        }

                        templateHtml = templateHtml.replace(/\{3\}/g, formDownloadUrl);

                        module.$downloadSummaryArea.append(templateHtml);
                    } else {
                        var templateHtml = moduleObj.actions.getTemplateFromElement(module.$multiDownloadAreaTemplate);

                        var subitemTemplates = "";

                        _(selectedFormAudiencePairs).each(function (selectedFormAudiencePair) {
                            var itemTemplateHtml = moduleObj.actions.getTemplateFromElement(module.$multiDownloadAreaItemTemplate);

                            itemTemplateHtml = itemTemplateHtml.replace(/\{0\}/g, selectedFormAudiencePair.form.documentTitle);

                            subitemTemplates = subitemTemplates + itemTemplateHtml;
                        });

                        templateHtml = templateHtml.replace(/\{0\}/g, subitemTemplates);
                        templateHtml = templateHtml.replace(/\{1\}/g, formDownloadUrl);

                        module.$downloadSummaryArea.append(templateHtml);
                    }
                }
            },

            resetStates: function (module) {
                moduleObj.actions.resetTransactionTypes(module);
            },

            resetCategories: function (module) {
                module.$categorySelectorArea.empty();
                module.$categorySelectorContainer.addClass(module.settings.disabledClass);

                moduleObj.actions.resetProductOptions(module);
            },

            resetTransactionTypes: function (module) {
                module.$transactionTypeSelectorArea.empty();

                moduleObj.actions.resetCategories(module);
            },

            resetProductOptions: function (module) {
                module.$productSelectorArea.empty();
                module.$productSelectorContainer.addClass(module.settings.disabledClass);

                moduleObj.actions.resetFormsArea(module);
            },

            resetFormsArea: function (module) {
                module.$formsArea.empty();

                moduleObj.actions.resetDownloadSummary(module);
            },

            resetDownloadSummary: function (module) {
                module.$downloadSummaryArea.empty();
            },

            registerChangeEvents: function (module) {
                module.$stateDropdownOptionArea.on("change", module, moduleObj.listen.changedStateOption);
                module.$categorySelectorArea.on("change", module, moduleObj.listen.changedCategoryOption);
                module.$transactionTypeSelectorArea.on("change", module, moduleObj.listen.changedTransactionTypeOption);
                module.$productSelectorArea.on("change", module, moduleObj.listen.changedProductOption);
                module.$formsArea.on("change", "[data-form-id]", module, moduleObj.listen.changedFormSelections);
                module.$element.on("click", "[data-modal].email-forms-button", module, moduleObj.listen.clickedEmailFormModal);
                module.$element.on("click", ".download-forms-button", module, moduleObj.analytics.trackFormDownloadEvent);
            },

            getTemplateFromElement: function ($element) {
                var elementHtml = $element.html();
                elementHtml = elementHtml.trim();

                return elementHtml;
            }
        }
    }).extend(symetra.formDownloadModuleBase));

})();;
(function () {
    "use strict";

    var moduleObj = moduler('individualsAndFamiliesFormsDownload', _({
        data: {

        },

        defaults: {
            defaultSecondDropdownValue: '-- Select a Report --',

            listChangeEvent: 'change',

            categorySelectorTemplate: '[data-template=CategorySelectorItem]',
            categorySelectorArea: '[data-section=CategorySelector]',
            categoryDescriptionContainer: '[data-template=CategoryItemDescriptor]',
            categoryDescriptionSelector: '[data-category={0}]',

            subCategoryContainer: '[data-section=SubCategoryContainer]',
            subcategorySelectorTemplate: '[data-template=SubCategorySelectorItem]',
            subcategorySelectorArea: '[data-section=SubCategorySelector]',

            actionExpandableContainer: '[data-section=ActionExpandableContainer]',
            actionSelectorTemplate: '[data-template=ActionExpandableItem]',
            actionSelectorArea: '[data-section=ActionExpandable]',

            actionSelectorSubitemTemplate: '[data-template=ActionExpandableSubItem]',
            downloadSummaryAreaTemplate: '[data-template=DownloadSummaryArea]',

            formDownloadSummaryContainer: '[data-section=FormDownloadSummaryContainer]',
            formDownloadSummaryArea: '[data-section=FormDownloadSummaryArea]',

            disabledClass: 'Box--disabled',
            hideShowToggleClass: 'u-hiddenVisually',

            // Forms Download URL 
            // TODO: Get From Server
            formsUrlDownloadBase: '/GetForms/',
        },

        init: function (module) {
            module.$categorySelectorTemplate = $(module.settings.categorySelectorTemplate);
            module.$categorySelectorArea = $(module.settings.categorySelectorArea);

            module.$subCategoryContainer = $(module.settings.subCategoryContainer);
            module.$subcategorySelectorTemplate = $(module.settings.subcategorySelectorTemplate);
            module.$subcategorySelectorArea = $(module.settings.subcategorySelectorArea);

            module.$actionExpandableContainer = $(module.settings.actionExpandableContainer);
            module.$actionSelectorTemplate = $(module.settings.actionSelectorTemplate);
            module.$actionSelectorArea = $(module.settings.actionSelectorArea);

            module.$actionExpandableSubItem = $(module.settings.actionSelectorSubitemTemplate);

            module.$downloadSummaryAreaTemplate = $(module.settings.downloadSummaryAreaTemplate);

            module.$formDownloadSummaryContainer = $(module.settings.formDownloadSummaryContainer);
            module.$formDownloadSummaryArea = $(module.settings.formDownloadSummaryArea);

            moduleObj.actions.initializeOptions(module);
        },

        listen: {

            changedCategoryOption: mo.event(function (module, event) {
                var $currentTarget = $(event.currentTarget);

                moduleObj.data.selections.category = _(moduleObj.data.productCategories).findWhere({ guid: $currentTarget.val() });

                // TODO: Refactor out GA event
                if (typeof gtag !== 'undefined' && !!moduleObj.data.selections.category) {
                    gtag('event', 'Select Product Category', {
                        'event_category': 'I&F Forms',
                        'event_label': moduleObj.data.selections.category.name + " [" + moduleObj.data.selections.category.guid + "]"
                    });
                }

                moduleObj.actions.setupSubCategories(module);
            }),

            changedSubCategoryOption: mo.event(function (module, event) {
                var $currentTarget = $(event.currentTarget);

                moduleObj.data.selections.subcategory = _(moduleObj.data.selections.category.terms).findWhere({ guid: $currentTarget.val() });

                // TODO: Refactor out GA event
                if (typeof gtag !== 'undefined' && !!moduleObj.data.selections.subcategory) {
                    gtag('event', 'Select Product Category', {
                        'event_category': 'I&F Forms',
                        'event_label': moduleObj.data.selections.subcategory.name + " [" + moduleObj.data.selections.subcategory.guid + "]"
                    });
                }

                moduleObj.actions.calculateApplicableForms(module); // Filters forms used in finding the formActions

                moduleObj.actions.setupFormActions(module);
            }),

            clickedFormAction: mo.event(function (module, event) {
                event.preventDefault();
                var $currentTarget = $(event.currentTarget);

                var selectedFormId = $currentTarget.data("form-id");

                $(".Expandable-link-tier", $currentTarget.parents(".Expandable")).removeClass("is-active"); // Close other panels
                $currentTarget.addClass("is-active");

                moduleObj.actions.displayDownloadForForm(module, selectedFormId);
            }),

            clickedEmailFormModal: mo.event(function (module, event) {
                var $formPanel = $(".email-forms-modal", module.$element);

                $("[data-bind=email-form-formids]").val(moduleObj.data.selections.selectedFormIds);
            }),

            clickedDownloadButton: mo.event(function (module, event) {
                var applicableForms = moduleObj.data.selections.applicableForms;
                var specifiedForm = _(applicableForms).findWhere({ formId: moduleObj.data.selections.selectedFormIds });

                // TODO: Refactor GA Event
                if (typeof gtag !== 'undefined' && !!specifiedForm) {
                    gtag('event', 'Download Form', {
                        'event_category': 'I&F Forms',
                        'event_label': specifiedForm.documentTitle + " [" + specifiedForm.formId + "]"
                    });
                }
            })
        },

        fn: {


        },

        actions: {

            initializeOptions: function (module) {
                var pageId = module.$element.data("page-id");
                var blockId = module.$element.data("block-id");

                moduleObj.shared.parseWidgetDataFromJson(pageId, blockId).then(function (blockData) {
                    moduleObj.data = blockData;

                    moduleObj.actions.registerEvents(module);
                    moduleObj.actions.setupCategories(module);
                });
            },

            registerEvents: function (module) {
                module.$element.on("click", "[data-modal].email-forms-button", module, moduleObj.listen.clickedEmailFormModal);
                module.$element.on("click", module.settings.formDownloadSummaryArea + " .Button[href]", module, moduleObj.listen.clickedDownloadButton);
            },

            setupCategories: function (module) {
                // Data for categories
                var categories = moduleObj.data.productCategories;

                moduleObj.actions.resetCategories(module);

                var containerInnerHtml = $(module.settings.categoryDescriptionContainer).html();
                var $categoryDescriptionContainer = $(containerInnerHtml);

                for (var x = 0; x < categories.length; x++) {
                    var categorySelectionOptionTemplate = moduleObj.actions.getTemplateFromElement(module.$categorySelectorTemplate);

                    categorySelectionOptionTemplate = categorySelectionOptionTemplate.replace(/\{numItems\}/g, categories.length);
                    categorySelectionOptionTemplate = categorySelectionOptionTemplate.replace(/\{0\}/g, x);
                    categorySelectionOptionTemplate = categorySelectionOptionTemplate.replace(/\{1\}/g, categories[x].name);
                    categorySelectionOptionTemplate = categorySelectionOptionTemplate.replace(/\{2\}/g, categories[x].guid);

                    var $categoryDescription = $categoryDescriptionContainer.find("[data-category='" + categories[x].name + "']");

                    if ($categoryDescription.length > 0) {
                        var categoryDescription = $categoryDescription.html();
                        categorySelectionOptionTemplate = categorySelectionOptionTemplate.replace(/\{4\}/g, "display: block;");
                        categorySelectionOptionTemplate = categorySelectionOptionTemplate.replace(/\{5\}/g, categoryDescription);
                    } else {
                        categorySelectionOptionTemplate = categorySelectionOptionTemplate.replace(/\{4\}/g, "display: none;");
                    }

                    var checkedString = (moduleObj.data.selections.category == categories[x]) ? "checked" : undefined;
                    categorySelectionOptionTemplate = categorySelectionOptionTemplate.replace(/\{3\}/g, checkedString);

                    module.$categorySelectorArea.append(categorySelectionOptionTemplate);
                }

                moduleObj.actions.registerCategoryChangeEvents(module);
            },

            setupSubCategories: function (module) {
                var subcategories = moduleObj.data.selections.category.terms;

                subcategories = _(subcategories).chain().filter(function (subcategoryToFilter) {
                    return moduleObj.actions.calculateApplicableFormsForValues(moduleObj.data.selections.category.guid, subcategoryToFilter.guid).length > 0;
                }).sortBy("name").value();

                moduleObj.actions.resetSubCategories(module);

                for (var x = 0; x < subcategories.length; x++) {
                    var categorySelectionOptionTemplate = moduleObj.actions.getTemplateFromElement(module.$subcategorySelectorTemplate);

                    categorySelectionOptionTemplate = categorySelectionOptionTemplate.replace(/\{0\}/g, x);
                    categorySelectionOptionTemplate = categorySelectionOptionTemplate.replace(/\{1\}/g, subcategories[x].name);
                    categorySelectionOptionTemplate = categorySelectionOptionTemplate.replace(/\{2\}/g, subcategories[x].guid);

                    var checkedString = (moduleObj.data.selections.subcategory == subcategories[x]) ? "checked" : undefined;
                    categorySelectionOptionTemplate = categorySelectionOptionTemplate.replace(/\{3\}/g, checkedString);

                    module.$subcategorySelectorArea.append(categorySelectionOptionTemplate);
                }

                module.$subCategoryContainer.removeClass(module.settings.disabledClass);

                moduleObj.actions.registerSubCategoryChangeEvents(module);
            },

            setupFormActions: function (module) {
                moduleObj.actions.resetFormActions(module);

                var formActions = moduleObj.actions.getApplicableFormAudiences(module);

                var partialGetSubitem = _.partial(moduleObj.actions.getFormActionSubitem, module);

                for (var x = 0; x < formActions.length; x++) {
                    var formAction = formActions[x];
                    var itemTemplate = moduleObj.actions.getTemplateFromElement(module.$actionSelectorTemplate);

                    var applicableFormsForAction = moduleObj.actions.getApplicableFormsForAction(module, formAction);
                    var applicableFormsSubitemsHtml = _(applicableFormsForAction).map(partialGetSubitem);
                    var applicableFormsSubitemHtml = applicableFormsSubitemsHtml.join(""); // Join with nothing, not comma

                    itemTemplate = itemTemplate.replace(/\{0\}/g, x);
                    itemTemplate = itemTemplate.replace(/\{1\}/g, formAction.actionName);
                    itemTemplate = itemTemplate.replace(/\{2\}/g, formAction.guid);
                    itemTemplate = itemTemplate.replace(/\{3\}/g, applicableFormsSubitemHtml);

                    module.$actionSelectorArea.append(itemTemplate);
                }

                module.$actionExpandableContainer.removeClass(module.settings.disabledClass);

                moduleObj.actions.registerFormActionsEvents(module);
            },

            resetCategories: function (module) {
                module.$categorySelectorArea.empty();

                moduleObj.actions.resetSubCategories(module);
            },

            resetSubCategories: function (module) {
                module.$subcategorySelectorArea.empty();
                module.$subCategoryContainer.addClass(module.settings.disabledClass);

                moduleObj.actions.resetFormActions(module);
            },

            resetFormActions: function (module) {
                module.$actionSelectorArea.empty();
                module.$actionExpandableContainer.addClass(module.settings.disabledClass);

                moduleObj.actions.resetDownloadSummary(module);
            },

            resetDownloadSummary: function (module) {
                module.$formDownloadSummaryArea.empty();
                module.$formDownloadSummaryContainer.addClass(module.settings.disabledClass);
            },

            registerCategoryChangeEvents: function (module) {
                module.$categorySelectorArea.find("input[type=radio]").on("click", module, moduleObj.listen.changedCategoryOption);
                symetra.downloadForm.init();
            },

            registerSubCategoryChangeEvents: function (module) {
                module.$subcategorySelectorArea.find("input[type=radio]").on("click", module, moduleObj.listen.changedSubCategoryOption);
                // move this into module
                symetra.downloadForm.init();

            },

            registerFormActionsEvents: function (module) {
                module.$actionSelectorArea.find(".Expandable-link-tier").on("click", module, moduleObj.listen.clickedFormAction);

                // Animation
                module.$actionSelectorArea.find(".Expandable-link").on("click", function (event) {
                    event.preventDefault();
                    var $target = $(event.currentTarget);
                    var $itemContainer = $target.parent();

                    // TODO: Refactor out GA event
                    var formActionName = $target.text();
                    if (typeof gtag !== 'undefined' && !!formActionName) {
                        gtag('event', 'Select Form Action', {
                            'event_category': 'I&F Forms',
                            'event_label': formActionName
                        });
                    }

                    $target.toggleClass("is-active");
                    $(".Accordion-panel", $itemContainer.siblings()).removeClass("is-active"); // Close other panels
                    $(".Expandable-link", $itemContainer.siblings()).removeClass("is-active"); // Remove is-active from link in other panels (+/- icon)
                    $itemContainer.find(".Accordion-panel").toggleClass("is-active");
                });
            },

            calculateApplicableForms: function (module) {
                var applicableForms = moduleObj.actions.calculateApplicableFormsForValues(moduleObj.data.selections.category.guid, moduleObj.data.selections.subcategory.guid);

                moduleObj.data.selections.applicableForms = applicableForms;
            },

            calculateApplicableFormsForValues: function (categoryGuid, subcategoryGuid) {
                var productIdentifierPrefix = categoryGuid + "|" + subcategoryGuid;

                var applicableForms = _(moduleObj.data.forms).chain().filter(function (form) {
                    var appliesToFilterCriteria = _(form.productIdentifiers).some(function (productIdent) {
                        return productIdent.indexOf(productIdentifierPrefix) == 0; // Starts with
                    });

                    return appliesToFilterCriteria;
                }).value();

                return applicableForms;
            },

            getApplicableFormAudiences: function (module) {
                var allFormActions = moduleObj.data.formWebAudiences;
                var applicableForms = moduleObj.data.selections.applicableForms;

                var formAudiencesFromApplicableForms = _(applicableForms).chain().pluck("formAudiences").flatten().uniq().value();

                return _(allFormActions).filter(function (formAction) {
                    return formAudiencesFromApplicableForms.indexOf(formAction.guid) != -1;
                });
            },

            getApplicableFormsForAction: function (module, formAction) {
                var applicableForms = moduleObj.data.selections.applicableForms;

                return _(applicableForms).filter(function (form) {
                    return form.formAudiences.indexOf(formAction.guid) != -1;
                });
            },

            getFormActionSubitem: function (module, form) {
                var itemTemplate = moduleObj.actions.getTemplateFromElement(module.$actionExpandableSubItem);

                itemTemplate = itemTemplate.replace(/\{0\}/g, form.formId);
                itemTemplate = itemTemplate.replace(/\{1\}/g, form.documentTitle);

                return itemTemplate;
            },

            displayDownloadForForm: function (module, formId) {
                var applicableForms = moduleObj.data.selections.applicableForms;
                var specifiedForm = _(applicableForms).findWhere({ formId: formId.toString() });
                var formDownloadUrl = module.settings.formsUrlDownloadBase + '?ids=' + formId;
                moduleObj.data.selections.selectedFormIds = formId;

                moduleObj.actions.resetDownloadSummary(module);

                var itemTemplate = moduleObj.actions.getTemplateFromElement(module.$downloadSummaryAreaTemplate);


                itemTemplate = itemTemplate.replace(/\{0\}/g, specifiedForm.formId);
                itemTemplate = itemTemplate.replace(/\{1\}/g, specifiedForm.documentTitle);

                // TODO: Refactor out GA event
                if (typeof gtag !== 'undefined') {
                    gtag('event', 'Select Form', {
                        'event_category': 'I&F Forms',
                        'event_label': specifiedForm.documentTitle + " [" + specifiedForm.formId + "]"
                    });
                }

                if (specifiedForm.documentDescription != null) {
                    itemTemplate = itemTemplate.replace(/\{2\}/g, specifiedForm.documentDescription);
                } else {
                    itemTemplate = itemTemplate.replace(/\{2\}/g, "");
                }

                itemTemplate = itemTemplate.replace(/\{3\}/g, formDownloadUrl);

                module.$formDownloadSummaryArea.append(itemTemplate);
                module.$formDownloadSummaryContainer.removeClass("Box--disabled");
            },

            getTemplateFromElement: function ($element) {
                var elementHtml = $element.html();
                elementHtml = elementHtml.trim();

                return elementHtml;
            }
        }
    }).extend(symetra.formDownloadModuleBase));

})();;
(function () {
    "use strict";


    var moduleObj = moduler('formQuickAccessWidget', _({
        defaults: {
            stateDropdownSelector: "[data-dropdown=State]",
            productCategoryDropdownSelector: "[data-dropdown=ProductCategory]",
            productDropdownSelector: "[data-dropdown=Product]",
            goButtonSelector: "[data-action=Go]",

            disabledClass: 'Select--disabled',
            stateDefaultOptionValue: "NO_STATE_SELECTED",

            // URL Args
            stateUrlArg: "state",
            categoryUrlArg: "category",
            subcategoryUrlArg: "subcategory",
            productUrlArg: "product",
        },

        init: function(module) {
            module.$stateDropdown = module.$element.find(module.settings.stateDropdownSelector);
            module.$productCategoryDropdown = module.$element.find(module.settings.productCategoryDropdownSelector);
            module.$productDropdown = module.$element.find(module.settings.productDropdownSelector);

            module.$stateDropdown.on("change", module, moduleObj.listen.changedStateDropdown);
            module.$productCategoryDropdown.on("change", module, moduleObj.listen.changedProductCategoryDropdown);
            module.$productDropdown.on("change", module, moduleObj.listen.changedProductDropdown);

            module.$goButton = module.$element.find(module.settings.goButtonSelector);

            moduleObj.actions.initializeWidget(module);
        },
        
        analytics: {
            getTypePrefix: function (module) {
                return module.$element.data("block-type") + " ";
            },

            trackStateChange: function (module) {
                var state = moduleObj.data.selections.state;

                if (!!state && typeof gtag !== 'undefined') {
                    gtag('event', 'Select State', {
                        'event_category': moduleObj.analytics.getTypePrefix(module) + 'Form Quick Access',
                        'event_label': state.name + " [" + state.guid + "]"
                    });
                }
            },

            trackProductCategoryChange: function (module) {
                var category = moduleObj.data.selections.category;

                if (!!category && typeof gtag !== 'undefined') {
                    gtag('event', 'Select Product Category', {
                        'event_category': moduleObj.analytics.getTypePrefix(module) + 'Form Quick Access',
                        'event_label': category.name + " [" + category.guid + "]"
                    });
                }
            },

            trackProductChange: function (module) {
                var product = moduleObj.data.selections.product;

                if (!!product && typeof gtag !== 'undefined') {
                    gtag('event', 'Select Product', {
                        'event_category': moduleObj.analytics.getTypePrefix(module) + 'Form Quick Access',
                        'event_label': product.name + " [" + product.guid + "]"
                    });
                }
            },

            trackClickedSearch: mo.event(function (module, event) {
                var $target = $(event.currentTarget);

                if (typeof gtag !== 'undefined') {
                    gtag('event', 'Click Go', {
                        'event_category': moduleObj.analytics.getTypePrefix(module) + 'Form Quick Access',
                        'event_label': $target.attr('href')
                    });
                }
            })
        },

        listen: {
            changedStateDropdown: mo.event(function(module, event) {
                var $currentTarget = $(event.currentTarget);
                var optionGuid = $currentTarget.val();

                if (optionGuid != module.settings.stateDefaultOptionValue) {
                    moduleObj.data.selections.state = _(moduleObj.data.states).findWhere({ guid: optionGuid });

                    moduleObj.analytics.trackStateChange(module);

                    moduleObj.actions.setupProductCategories(module);
                } else {
                    moduleObj.actions.resetProductCategories(module);

                    moduleObj.actions.disableDropdown(module, module.$productCategoryDropdown);
                }
            }),

            changedProductCategoryDropdown: mo.event(function(module, event) {
                var $currentTarget = $(event.currentTarget);
                var optionGuid = $currentTarget.val();

                if (!!optionGuid) {
                    moduleObj.data.selections.category = _(moduleObj.data.productCategories).findWhere({ guid: optionGuid });

                    moduleObj.analytics.trackProductCategoryChange(module);

                    moduleObj.actions.setupProducts(module);
                }
            }),

            changedProductDropdown: mo.event(function(module, event) {
                var $currentTarget = $(event.currentTarget);
                var optionGuid = $currentTarget.val();

                if (!!optionGuid) {
                    var allProductsUnderCategory = _(moduleObj.data.selections.category.terms).chain().pluck("terms").flatten().value();

                    moduleObj.data.selections.subcategory = _(moduleObj.data.selections.category.terms).find(function(subcategory) {
                        return !!_(subcategory.terms).findWhere({ guid: optionGuid });
                    });

                    moduleObj.data.selections.product = _(allProductsUnderCategory).findWhere({ guid: optionGuid });

                    moduleObj.analytics.trackProductChange(module);

                    moduleObj.actions.setupGoButton(module);
                }
            }),
        },

        actions: {
            initializeWidget: function(module) {
                var pageId = module.$element.data("page-id");
                var blockId = module.$element.data("block-id");

                module.$goButton.on("click", module, moduleObj.analytics.trackClickedSearch);

                moduleObj.shared.parseWidgetDataFromJson(pageId, blockId).then(function(blockData) {
                    // Success
                    moduleObj.data = blockData;

                    moduleObj.actions.setupStates(module);
                }, function() {
                    // Failed
                });
            },

            setupStates: function(module) {
                var states = moduleObj.data.states;

                moduleObj.cleanup.resetStates(module);
            },

            setupProductCategories: function(module) {
                var categories = moduleObj.data.productCategories;

                categories = _(categories).chain().filter(function (categoryToFilter) {
                    return moduleObj.shared.getApplicableFormsForSelections(moduleObj.data.forms, moduleObj.data.productCategories, moduleObj.data.productOfferings, moduleObj.data.selections.state.guid, undefined, undefined, categoryToFilter.guid).length > 0;
                }).sortBy("name").value();

                moduleObj.cleanup.resetProductCategories(module);


                var $allOptions = _(categories).map(function(category) {
                    var optionLi = $("<option>");

                    optionLi.val(category.guid);
                    optionLi.text(category.name);

                    return optionLi;
                });

                if ($allOptions.length > 0) {
                    moduleObj.actions.enableDropdown(module, module.$productCategoryDropdown);
                }

                module.$productCategoryDropdown.append($allOptions);
            },

            setupProducts: function(module) {
                var products = _(moduleObj.data.selections.category.terms).chain().pluck("terms").flatten().value();

                products = _(products).chain().filter(function (productToFilter) {
                    return moduleObj.shared.getApplicableFormsForSelections(moduleObj.data.forms, moduleObj.data.productCategories, moduleObj.data.productOfferings, moduleObj.data.selections.state.guid, undefined, undefined, moduleObj.data.selections.category.guid, productToFilter.guid).length > 0;
                }).sortBy("name").value();

                moduleObj.cleanup.resetProducts(module);

                var $allOptions = _(products).map(function(product) {
                    var optionLi = $("<option>");

                    optionLi.val(product.guid);
                    optionLi.text(product.name);

                    return optionLi;
                });

                if ($allOptions.length > 0) {
                    moduleObj.actions.enableDropdown(module, module.$productDropdown);
                }

                module.$productDropdown.append($allOptions);
            },

            setupGoButton: function(module) {
                var formWidgetUrl = module.$element.data("widget-url") + "#";

                if (!!moduleObj.data.selections.state) {
                    formWidgetUrl = formWidgetUrl + "state=" + moduleObj.data.selections.state.guid;

                    if (!!moduleObj.data.selections.category) {
                        formWidgetUrl = formWidgetUrl + "&category=" + moduleObj.data.selections.category.guid;

                        if (!!moduleObj.data.selections.subcategory) {
                            formWidgetUrl = formWidgetUrl + "&subcategory=" + moduleObj.data.selections.subcategory.guid;

                            if (!!moduleObj.data.selections.product) {
                                formWidgetUrl = formWidgetUrl + "&product=" + moduleObj.data.selections.product.guid;

                                module.$goButton.attr("href", formWidgetUrl);
                                module.$goButton.show();
                            }
                        }
                    }
                }
            },


            disableDropdown: function(module, $element) {
                $element.addClass(module.settings.disabledClass);
                $element.prop("disabled", true);
            },

            enableDropdown: function(module, $element) {
                $element.removeClass(module.settings.disabledClass);
                $element.prop("disabled", false);
            }
        },


        cleanup: {
            resetStates: function(module) {
                moduleObj.cleanup.resetProductCategories(module);
            },

            resetProductCategories: function(module) {
                module.$productCategoryDropdown.empty();

                var $placeHolderOption = $("<option>").text("-- Select a Product Category --");
                module.$productCategoryDropdown.append($placeHolderOption);

                moduleObj.actions.disableDropdown(module, module.$productCategoryDropdown);

                if (document.activeElement == module.$productCategoryDropdown[0]) {
                    module.$productCategoryDropdown.blur();
                }

                moduleObj.cleanup.resetProducts(module);
            },

            resetProducts: function(module) {
                module.$productDropdown.empty();

                var $placeHolderOption = $("<option>").text("-- Select a Product --");
                module.$productDropdown.append($placeHolderOption);

                if (document.activeElement == module.$productDropdown[0]) {
                    module.$productDropdown.blur();
                }

                moduleObj.actions.disableDropdown(module, module.$productDropdown);

                moduleObj.cleanup.resetGoButton(module);
            },

            resetGoButton: function(module) {
                module.$goButton.hide();
            }
        }

    }).extend(symetra.formDownloadModuleBase));
    
})();;
(function () {
    "use strict";


    var moduleObj = moduler('marketingMaterialQuickAccessWidget', _({
        defaults: {
            stateDropdownSelector: "[data-dropdown=State]",
            productCategoryDropdownSelector: "[data-dropdown=ProductCategory]",
            productDropdownSelector: "[data-dropdown=Product]",
            goButtonSelector: "[data-action=Go]",

            disabledClass: 'Select--disabled',
            stateDefaultOptionValue: "NO_STATE_SELECTED",

            // URL Args
            stateUrlArg: "state",
            categoryUrlArg: "category",
            subcategoryUrlArg: "subcategory",
            productUrlArg: "product",
        },

        analytics: {
            getTypePrefix: function (module) {
                return module.$element.data("block-type") + " ";
            },

            trackStateChange: function (module) {
                var state = moduleObj.data.selections.state;

                if (typeof gtag !== 'undefined' && !!state) {
                    gtag('event', 'Select State', {
                        'event_category': moduleObj.analytics.getTypePrefix(module) + 'MM Quick Access',
                        'event_label': state.name + " [" + state.guid + "]"
                    });
                }
            },

            trackProductCategoryChange: function (module) {
                var category = moduleObj.data.selections.category;

                if (typeof gtag !== 'undefined' && !!category) {
                    gtag('event', 'Select Product Category', {
                        'event_category': moduleObj.analytics.getTypePrefix(module) + 'MM Quick Access',
                        'event_label': category.name + " [" + category.guid + "]"
                    });
                }
            },

            trackProductChange: function (module) {
                var product = moduleObj.data.selections.product;

                if (typeof gtag !== 'undefined' && !!product) {
                    gtag('event', 'Select Product', {
                        'event_category': moduleObj.analytics.getTypePrefix(module) + 'MM Quick Access',
                        'event_label': product.name + " [" + product.guid + "]"
                    });
                }
            },

            trackClickedSearch: mo.event(function (module, event) {
                var $target = $(event.currentTarget);

                if (typeof gtag !== 'undefined') {
                    gtag('event', 'Click Go', {
                        'event_category': moduleObj.analytics.getTypePrefix(module) + 'MM Quick Access',
                        'event_label': $target.attr('href')
                    });
                }
            })
        },


        init: function(module) {
            module.$stateDropdown = module.$element.find(module.settings.stateDropdownSelector);
            module.$productCategoryDropdown = module.$element.find(module.settings.productCategoryDropdownSelector);
            module.$productDropdown = module.$element.find(module.settings.productDropdownSelector);

            module.$stateDropdown.on("change", module, moduleObj.listen.changedStateDropdown);
            module.$productCategoryDropdown.on("change", module, moduleObj.listen.changedProductCategoryDropdown);
            module.$productDropdown.on("change", module, moduleObj.listen.changedProductDropdown);

            module.$goButton = module.$element.find(module.settings.goButtonSelector);

            moduleObj.actions.initializeWidget(module);
        },

        listen: {
            changedStateDropdown: mo.event(function(module, event) {
                var $currentTarget = $(event.currentTarget);
                var optionGuid = $currentTarget.val();

                if (optionGuid != module.settings.stateDefaultOptionValue) {
                    moduleObj.data.selections.state = _(moduleObj.data.states).findWhere({ guid: optionGuid });

                    moduleObj.actions.setupProductCategories(module);
                } else {
                    moduleObj.actions.resetProductCategories(module);

                    moduleObj.actions.disableDropdown(module, module.$productCategoryDropdown);
                }
            }),

            changedProductCategoryDropdown: mo.event(function(module, event) {
                var $currentTarget = $(event.currentTarget);
                var optionGuid = $currentTarget.val();

                if (!!optionGuid) {
                    moduleObj.data.selections.category = _(moduleObj.data.productCategories).findWhere({ guid: optionGuid });

                    moduleObj.actions.setupProducts(module);
                }
            }),

            changedProductDropdown: mo.event(function(module, event) {
                var $currentTarget = $(event.currentTarget);
                var optionGuid = $currentTarget.val();

                if (!!optionGuid) {
                    var allProductsUnderCategory = _(moduleObj.data.selections.category.terms).chain().pluck("terms").flatten().value();

                    moduleObj.data.selections.subcategory = _(moduleObj.data.selections.category.terms).find(function(subcategory) {
                        return !!_(subcategory.terms).findWhere({ guid: optionGuid });
                    });

                    moduleObj.data.selections.product = _(allProductsUnderCategory).findWhere({ guid: optionGuid });

                    moduleObj.actions.setupGoButton(module);
                }
            }),
        },

        actions: {
            initializeWidget: function(module) {
                var pageId = module.$element.data("page-id");
                var blockId = module.$element.data("block-id");

                moduleObj.shared.parseWidgetDataFromJson(pageId, blockId).then(function(blockData) {
                    // Success
                    moduleObj.data = blockData;

                    moduleObj.actions.setupStates(module);
                }, function() {
                    // Failed
                });
            },

            setupStates: function(module) {
                var states = moduleObj.data.states;

                moduleObj.cleanup.resetStates(module);
            },

            setupProductCategories: function(module) {
                var categories = moduleObj.data.productCategories;

                // Remove options without forms associated
                categories = _(categories).chain().filter(function (categoryToFilter) {
                    return moduleObj.shared.getApplicableFormsForSelections(moduleObj.data.forms, moduleObj.data.productCategories, moduleObj.data.productOfferings, moduleObj.data.selections.state.guid, undefined, undefined, categoryToFilter.guid).length > 0;
                }).sortBy("name").value();

                moduleObj.cleanup.resetProductCategories(module);


                var $allOptions = _(categories).map(function(category) {
                    var optionLi = $("<option>");

                    optionLi.val(category.guid);
                    optionLi.text(category.name);

                    return optionLi;
                });

                if ($allOptions.length > 0) {
                    moduleObj.actions.enableDropdown(module, module.$productCategoryDropdown);
                }

                module.$productCategoryDropdown.append($allOptions);
            },

            setupProducts: function(module) {
                var products = _(moduleObj.data.selections.category.terms).chain().pluck("terms").flatten().value();

                products = _(products).chain().filter(function (productToFilter) {
                    return moduleObj.shared.getApplicableFormsForSelections(moduleObj.data.forms, moduleObj.data.productCategories, moduleObj.data.productOfferings, moduleObj.data.selections.state.guid, undefined, undefined, moduleObj.data.selections.category.guid, productToFilter.guid).length > 0;
                }).sortBy("name").value();

                moduleObj.cleanup.resetProducts(module);

                var $allOptions = _(products).map(function(product) {
                    var optionLi = $("<option>");

                    optionLi.val(product.guid);
                    optionLi.text(product.name);

                    return optionLi;
                });

                if ($allOptions.length > 0) {
                    moduleObj.actions.enableDropdown(module, module.$productDropdown);
                }

                module.$productDropdown.append($allOptions);
            },

            setupGoButton: function(module) {
                var formWidgetUrl = module.$element.data("widget-url") + "#";

                if (!!moduleObj.data.selections.state) {
                    formWidgetUrl = formWidgetUrl + "state=" + moduleObj.data.selections.state.guid;

                    if (!!moduleObj.data.selections.category) {
                        formWidgetUrl = formWidgetUrl + "&category=" + moduleObj.data.selections.category.guid;

                        if (!!moduleObj.data.selections.subcategory) {
                            formWidgetUrl = formWidgetUrl + "&subcategory=" + moduleObj.data.selections.subcategory.guid;

                            if (!!moduleObj.data.selections.product) {
                                formWidgetUrl = formWidgetUrl + "&product=" + moduleObj.data.selections.product.guid;

                                module.$goButton.attr("href", formWidgetUrl);
                                module.$goButton.show();
                            }
                        }
                    }
                }
            },


            disableDropdown: function(module, $element) {
                $element.addClass(module.settings.disabledClass);
                $element.prop("disabled", true);
            },

            enableDropdown: function(module, $element) {
                $element.removeClass(module.settings.disabledClass);
                $element.prop("disabled", false);
            }
        },


        cleanup: {
            resetStates: function(module) {
                moduleObj.cleanup.resetProductCategories(module);
            },

            resetProductCategories: function(module) {
                module.$productCategoryDropdown.empty();

                var $placeHolderOption = $("<option>").text("-- Select a Product Category --");
                module.$productCategoryDropdown.append($placeHolderOption);


                if (document.activeElement == module.$productCategoryDropdown[0]) {
                    module.$productCategoryDropdown.blur();
                }

                moduleObj.actions.disableDropdown(module, module.$productCategoryDropdown);

                moduleObj.cleanup.resetProducts(module);
            },

            resetProducts: function(module) {
                module.$productDropdown.empty();

                var $placeHolderOption = $("<option>").text("-- Select a Product --");
                module.$productDropdown.append($placeHolderOption);

                if (document.activeElement == module.$productDropdown[0]) {
                    module.$productDropdown.blur();
                }

                moduleObj.actions.disableDropdown(module, module.$productDropdown);

                moduleObj.cleanup.resetGoButton(module);
            },

            resetGoButton: function(module) {
                module.$goButton.hide();
            }
        }

    }).extend(symetra.marketingModuleBase));
    
})();;
(function () {
    "use strict";

    var moduleObj = moduler('advisoryListBlock', {
        defaults: {
            categoryFilterHandle: '[data-filter-handle]',
            columnHandles: '[data-filtered-column]',

            filterDropdown: '[data-filter-control=Dropdown]',

            filterActionButton: '[data-filter-action=Filter]',
            filterResetActionButton: '[data-filter-action=Reset]',

            actionPanelWrapperClass: '.action-panel',

            stateColumnIndex: 3
        },

        init: function (module) {
            module.$filterDropdown = module.$element.find(module.settings.filterDropdown);
            module.$filterActionButton = module.$element.find(module.settings.filterActionButton);
            module.$filterResetActionButton = module.$element.find(module.settings.filterResetActionButton);
            module.$actionPanelWrapperClass = module.$element.find(module.settings.actionPanelWrapperClass);

            module.$filterHandles = module.$element.find(module.settings.categoryFilterHandle);
            module.$columnHandles = module.$element.find(module.settings.columnHandles);

            module.$filterDropdown.on("change", module, moduleObj.changedFilterDropdown);
            module.$filterHandles.on("click", module, moduleObj.setupFilterForHandleClick);
            module.$filterResetActionButton.on("click", module, moduleObj.resetFilter);

            module.$dataTable = module.$element.find(".advisory-table").DataTable({
                paging: false,
                info: false,
                searching: true
            });

            // Seed Filter Options from non-filtered data
            _(module.$filterHandles).each(function (filterHandle) {
                var $handle = $(filterHandle);

                moduleObj.getAllFilterOptionsForKey(module, $handle.data("filter-handle"));
            });

            // Initial Filter
            module.$dataTable.order([module.settings.stateColumnIndex, "desc"]).draw();
        },

        setupFilterForHandleClick: mo.event(function (module, event) {
            var $targetFilterHandle = $(event.currentTarget);

            var filterKey = $targetFilterHandle.data("filter-handle");
            module.filterKey = filterKey;

            moduleObj.resetSearch(module);
            moduleObj.setupFilterOptionsForKey(module, filterKey);

            moduleObj.doFilter(module);
        }),

        resetFilter: mo.event(function (module, event) {
            event.preventDefault();

            module.$filterHandles.prop("checked", false);
            module.$actionPanelWrapperClass.hide();

            moduleObj.resetSearch(module);

            module.$dataTable.order([module.settings.stateColumnIndex, "desc"]).draw();
        }),

        resetSearch: function (module) {
            for (var i = 0; i < module.$columnHandles.length; i++)
                module.$dataTable.column(i).search("").draw();
        },

        changedFilterDropdown: mo.event(function (module, event) {
            moduleObj.doFilter(module);
        }),

        doFilter: function (module) {
            var filterValue = module.$filterDropdown.val();

            moduleObj.filterForKey(module, module.filterKey, filterValue);
        },

        setupFilterOptionsForKey: function (module, filterKey) {
            var allFilterOptions = moduleObj.getAllFilterOptionsForKey(module, filterKey);

            module.$filterDropdown.empty();

            var $filterOptions = _(allFilterOptions).map(function (filterOption) {
                var $option = $("<option />");

                $option.text(filterOption);
                $option.val(filterOption);

                return $option;
            });

            module.$filterDropdown.append($filterOptions);

            module.$actionPanelWrapperClass.show();
        },

        getAllFilterOptionsForKey: _.memoize(function (module, filterKey) {
            var $allFilterElements = module.$element.find("[data-filter-value=" + filterKey + "]");

            var filterValues = _($allFilterElements).chain().pluck("innerHTML").uniq().without("[ALL]").sortBy(function (filterValue) { return filterValue; }).value();

            // Special formatting for some filter values
            if (filterKey == "State") {
                filterValues = _(["[ALL]"]).union(filterValues);
            } else if (filterKey == "Year") {
                filterValues = _(filterValues).chain().map(function (filterDateValue) {
                    return moment(filterDateValue).format("YYYY");
                }).uniq().sortBy(function (fv) {
                    return -fv;
                }).value();
            }

            return filterValues;
        }, function (module, filterKey) {
            return filterKey;
        }),

        filterForKey: function (module, filterKey, filterValue) {
            var columnWeWant = module.$element.find("[data-filtered-column=" + filterKey + "]");
            var columnIndex = module.$element.find("[data-filtered-column]").index(columnWeWant);

            // Reset
            moduleObj.resetSearch(module);

            // State Specific All Filter (Returns State values, plus [ALL] values)
            if (filterKey == "State") {

                module.$dataTable.order([columnIndex, "desc"]); // Order by State, then [ALL]

                if (filterValue == "[ALL]") {
                    // Do not sort states with [ALL] tag
                    module.$dataTable.column(columnIndex).search("").draw();
                } else {
                    var filterValueRegex = filterValue;

                    if (!filterValue.match(/New York/i)) {
                        filterValueRegex = "(\\[ALL\\]|" + filterValue + ")";
                    }

                    module.$dataTable.column(columnIndex).search(filterValueRegex, true, false).draw();
                }
            } else {
                module.$dataTable.column(columnIndex).search(filterValue).draw();

                module.$dataTable.order([module.settings.stateColumnIndex, "desc"]).draw();
            }
        }
    });

})();;
(function () {
    "use strict";

    var shoppingCartRemoveEvent = 'symetracart.removeitem';
    var shoppingCartAddEvent = 'symetracart.additem';

    var moduleObj = moduler('marketingMaterialsByPieceCategory', _({
        data: {

        },

        defaults: {
            pieceCategorySelectorContainer: '[data-section=CategorySelectorContainer]',
            pieceCategorySelectorArea: '[data-section=CategorySelectorArea]',
            pieceCategorySelectorTemplate: '[data-template=OptionItem]',

            categorySelectorContainer: '[data-section=SubCategorySelectorContainer]',
            categorySelectorArea: '[data-section=SubCategorySelectorArea]',
            categorySelectorTemplate: '[data-template=OptionItem]',

            productSelectorContainer: '[data-section=ProductSelectorContainer]',
            productSelectorArea: '[data-section=ProductSelectorArea]',
            productSelectorTemplate: '[data-template=OptionItem]',

            marketingMaterialSelectorContainer: '[data-section=MarketingMaterialSelectorContainer]',
            marketingMaterialSelectorArea: '[data-section=MarketingMaterialSelectorArea]',
            marketingMaterialSelectorItem: '[data-template=OptionItem]',

            materialSummaryArea: '[data-section=MaterialSummaryArea]',
            materialSummaryAreaItem: '[data-template=MaterialSummaryAreaItem]',

            stateDropdownOptionArea: '[data-section=StateDropdownOptionArea]',
            stateDropdownOptionItemTemplate: '[data-template=OptionItem]',
            stateDropdownDefaultOptionItemTemplate: '[data-template=StateDropdownDefaultOption]',

            requiredFormsCategoryTemplate: '[data-template=RequiredFormsCategory]',
            optionalFormsCategoryTemplate: '[data-template=OptionalFormsCategory]',
            serviceFormsCategoryTemplate: '[data-template=ServiceFormsCategory]',

            disabledClass: 'Box--disabled',
            hideShowToggleClass: 'u-hiddenVisually',
            stateDefaultOptionValue: "NO_STATE_SELECTED",

            // URL Args
            stateUrlArg: "state",
            pieceCategoryUrlArg: "piece",
            categoryUrlArg: "category",
            subcategoryUrlArg: "subcategory",
            productUrlArg: "product",
            materialUrlArg: "material",

            // Forms Download URL 
            // TODO: Get From Server
            formsUrlDownloadBase: '/GetForms/',
        },

        init: function (module) {
            module.$pieceCategorySelectorContainer = module.$element.find(module.settings.pieceCategorySelectorContainer);
            module.$pieceCategorySelectorArea = module.$element.find(module.settings.pieceCategorySelectorArea);
            module.$pieceCategorySelectorTemplate = $(module.settings.pieceCategorySelectorTemplate);

            module.$categorySelectorContainer = module.$element.find(module.settings.categorySelectorContainer);
            module.$categorySelectorArea = module.$element.find(module.settings.categorySelectorArea);
            module.$categorySelectorTemplate = $(module.settings.categorySelectorTemplate);

            module.$productSelectorContainer = module.$element.find(module.settings.productSelectorContainer);
            module.$productSelectorArea = module.$element.find(module.settings.productSelectorArea);
            module.$productSelectorTemplate = $(module.settings.productSelectorTemplate);

            module.$stateDropdownOptionArea = module.$element.find(module.settings.stateDropdownOptionArea);

            module.$requiredFormsCategoryTemplate = $(module.settings.requiredFormsCategoryTemplate);
            module.$optionalFormsCategoryTemplate = $(module.settings.optionalFormsCategoryTemplate);
            module.$serviceFormsCategoryTemplate = $(module.settings.serviceFormsCategoryTemplate);
            module.$formsCategoryItemTemplate = $(module.settings.formsCategoryItemTemplate);

            module.$marketingMaterialSelectorContainer = module.$element.find(module.settings.marketingMaterialSelectorContainer);
            module.$marketingMaterialSelectorArea = module.$element.find(module.settings.marketingMaterialSelectorArea);
            module.$marketingMaterialSelectorItem = $(module.settings.marketingMaterialSelectorItem);

            module.$materialSummaryArea = module.$element.find(module.settings.materialSummaryArea);
            module.$materialSummaryAreaItem = $(module.settings.materialSummaryAreaItem);

            module.$materialSummaryArea.on("click", "[data-addtocart]", module, moduleObj.listen.addItemToCart);

            $(document).on("click", ".Modal--wide .email-forms-submit-button", module, moduleObj.analytics.trackFormEmailEvent);

            moduleObj.actions.initializeOptions(module);
        },

        // TODO: Refactor reused Event Category
        analytics: {
            getTypePrefix: function (module) {
                return module.$element.data("block-type") + " ";
            },

            trackStateChange: function (module) {
                var state = moduleObj.data.selections.state;

                if (typeof gtag !== 'undefined' && !!state) {
                    gtag('event', 'Select State', {
                        'event_category': moduleObj.analytics.getTypePrefix(module) + 'MM Download [By Piece Category]',
                        'event_label': state.name + " [" + state.guid + "]"
                    });
                }
            },

            trackProductCategoryChange: function (module) {
                var category = moduleObj.data.selections.category;

                if (typeof gtag !== 'undefined' && !!category) {
                    gtag('event', 'Select Product Category', {
                        'event_category': moduleObj.analytics.getTypePrefix(module) + 'MM Download [By Piece Category]',
                        'event_label': category.name + " [" + category.guid + "]"
                    });
                }
            },

            trackPieceCategoryChange: function (module) {
                var piece = moduleObj.data.selections.piece;

                if (typeof gtag !== 'undefined' && !!piece) {
                    gtag('event', 'Select Piece Category', {
                        'event_category': moduleObj.analytics.getTypePrefix(module) + 'MM Download [By Piece Category]',
                        'event_label': piece.name + " [" + piece.guid + "]"
                    });
                }
            },


            trackProductChange: function (module) {
                var product = moduleObj.data.selections.product;

                if (typeof gtag !== 'undefined' && !!product) {
                    gtag('event', 'Select Product', {
                        'event_category': moduleObj.analytics.getTypePrefix(module) + 'MM Download [By Piece Category]',
                        'event_label': product.name + " [" + product.guid + "]"
                    });
                }
            },

            trackMarketingMaterialChange: function (module) {
                var marketingMaterial = moduleObj.data.selections.marketingMaterial;

                if (typeof gtag !== 'undefined' && !!marketingMaterial) {
                    gtag('event', 'Select Marketing Material', {
                        'event_category': moduleObj.analytics.getTypePrefix(module) + 'MM Download [By Piece Category]',
                        'event_label': marketingMaterial.documentTitle + " [" + marketingMaterial.formId + "]"
                    });
                }
            },
            
            trackFormDownloadEvent: mo.event(function (module, event) {
                if (typeof gtag !== 'undefined' && !!moduleObj.data.selections.selectedFormIds && moduleObj.data.selections.selectedFormIds.length > 0) {
                    gtag('event', 'Download Form(s)', {
                        'event_category': moduleObj.analytics.getTypePrefix(module) + 'MM Download [By Piece Category]',
                        'event_label': moduleObj.data.selections.selectedFormIds
                    });
                }
            }),

            trackFormEmailEvent: mo.event(function (module, event) {
                if (typeof gtag !== 'undefined' && !!moduleObj.data.selections.selectedFormIds && moduleObj.data.selections.selectedFormIds.length > 0) {
                    gtag('event', 'Emailed Form(s)', {
                        'event_category': moduleObj.analytics.getTypePrefix(module) + 'MM Download [By Piece Category]',
                        'event_label': moduleObj.data.selections.selectedFormIds
                    });
                }
            })
        },

        listen: {
            changedStateOption: mo.event(function (module, event) {
                var $currentTarget = $(event.currentTarget);
                var stateGuid = $currentTarget.val();

                if (stateGuid != null && stateGuid != module.settings.stateDefaultOptionValue) {
                    moduleObj.data.selections.state = _(moduleObj.data.states).findWhere({ guid: stateGuid });

                    moduleObj.analytics.trackStateChange(module);

                    moduleObj.actions.setupCategories(module);
                } else {
                    moduleObj.actions.resetCategories(module);
                    module.$categorySelectorContainer.addClass(module.settings.disabledClass);
                }
            }),

            changedCategoryOption: mo.event(function (module, event) {
                // Piece Category 
                var $currentTarget = $(event.currentTarget);
                var pieceCategoryGuid = $currentTarget.val();

                if (!!pieceCategoryGuid) {
                    moduleObj.data.selections.piece = _(moduleObj.data.pieceCategories).findWhere({ guid: pieceCategoryGuid });

                    moduleObj.analytics.trackPieceCategoryChange(module);

                    moduleObj.actions.setupSubCategories(module);
                }
            }),

            changedSubCategoryOption: mo.event(function (module, event) {
                // Product Category 
                var $currentTarget = $(event.currentTarget);
                var categoryGuid = $currentTarget.val();

                if (!!categoryGuid) {
                    moduleObj.data.selections.category = _(moduleObj.data.productCategories).findWhere({ guid: categoryGuid });

                    moduleObj.analytics.trackProductCategoryChange(module);

                    moduleObj.actions.setupProducts(module);
                }
            }),

            changedProductOption: mo.event(function (module, event) {
                var $currentTarget = $(event.currentTarget);
                var productGuid = $currentTarget.val();

                if (!!productGuid) {
                    var allProducts = _(moduleObj.data.selections.category.terms).chain().pluck("terms").flatten().value();
                    moduleObj.data.selections.product = _(allProducts).findWhere({ guid: productGuid });

                    moduleObj.analytics.trackProductChange(module);

                    moduleObj.actions.calculateApplicableForms(module); // Filters forms used in finding the formActions

                    moduleObj.actions.setupMarketingMaterials(module);
                }
            }),

            changedMarketingMaterialOption: mo.event(function (module, event) {
                var $currentTarget = $(event.currentTarget);
                var materialDocumentId = $currentTarget.val();

                if (!!materialDocumentId) {
                    moduleObj.data.selections.marketingMaterial = _(moduleObj.data.selections.applicableForms).findWhere({ formId: materialDocumentId });

                    moduleObj.analytics.trackMarketingMaterialChange(module);

                    moduleObj.listen.logDirectUrl(module);

                    moduleObj.actions.calculateApplicableForms(module); // Filters forms used in finding the formActions

                    moduleObj.actions.setupMarketingMaterialSummary(module);
                }
            }),

            logDirectUrl: function (module) {
                var windowLocation = window.location.toString();

                var pagePath = windowLocation;

                if (windowLocation.indexOf("#") != -1) {
                    pagePath = windowLocation.substring(0, windowLocation.indexOf("#"));
                }

                pagePath = pagePath + "#";

                var additionalArgs = "";

                var addToArgs = function (objectTerm, termKey, objectProperty) {
                    if (!!objectTerm) {
                        if (additionalArgs.length != 0) {
                            additionalArgs = additionalArgs + "&";
                        }

                        if (!!objectProperty) {
                            additionalArgs = additionalArgs + termKey + "=" + objectTerm[objectProperty];
                        } else {
                            additionalArgs = additionalArgs + termKey + "=" + objectTerm.guid;
                        }
                    } else {
                        // No term
                        if (!!objectProperty) {
                            additionalArgs = additionalArgs + termKey + "=" + objectProperty;
                        }
                    }
                };

                addToArgs(undefined, "tab", "category");
                addToArgs(moduleObj.data.selections.state, "state");
                addToArgs(moduleObj.data.selections.piece, "piece");
                addToArgs(moduleObj.data.selections.category, "category");
                addToArgs(moduleObj.data.selections.subcategory, "subcategory");
                addToArgs(moduleObj.data.selections.product, "product");
                addToArgs(moduleObj.data.selections.marketingMaterial, "material", "formId");

                console.log(pagePath + additionalArgs);
            },

            addItemToCart: mo.event(function (module, event) {
                event.preventDefault(); // No anchor tag #

                var $target = $(event.currentTarget);
                var $addItemToCartWrapper = $target.parent().parent();

                var $quantityTextField = $addItemToCartWrapper.find("input[type=text]");
                var $validationMessage = $addItemToCartWrapper.find(".quantity-validation-msg");
                $validationMessage.hide();

                var materialId = "" + $target.data("addtocart");
                var quantity = parseInt($quantityTextField.val());

                if (quantity > 0 && quantity <= 50) {
                    $(window).trigger(shoppingCartAddEvent, {
                        item: moduleObj.data.selections.marketingMaterial,
                        quantity: quantity,
                        itemId: moduleObj.data.selections.marketingMaterial.formId
                    });
                } else {
                    // TODO: Display error message from requirements
                    $validationMessage.show();
                }
            }),

            clickedEmailFormModal: mo.event(function (module, event) {
                var $formPanel = $(".email-forms-modal", module.$element);

                $("[data-bind=email-form-formids]").val(moduleObj.data.selections.selectedFormIds);

                var $emailFormSummaryList = $("[data-section=EmailFormsList]");

                var $generatedListSummaryItems = _.map(moduleObj.data.selections.selectedForms, function (form) {
                    var encodedFormIds = encodeURIComponent(form.formId);
                    var formDownloadUrl = module.settings.formsUrlDownloadBase + '?ids=' + encodedFormIds;

                    var $li = $("<li>");

                    var $link = $("<a>");

                    $link.attr("href", formDownloadUrl);
                    $link.text(form.documentTitle);

                    $li.append($link);

                    return $li;
                });

                $emailFormSummaryList.append($generatedListSummaryItems);
            }),
        },

        fn: {
            isSelectedGuid: function (guid) {
                return moduleObj.data.selections.indexOf(guid) != -1;
            }

        },

        actions: {
            initializeOptions: function (module) {
                var pageId = module.$element.data("page-id");
                var blockId = module.$element.data("block-id");

                moduleObj.shared.parseWidgetDataFromJson(pageId, blockId).then(function (blockData) {
                    moduleObj.data = blockData;

                    moduleObj.actions.registerChangeEvents(module);

                    moduleObj.actions.setupStates(module);

                    moduleObj.shared.seedTabFromUrl(module);
                    moduleObj.actions.seedFromUrl(module);
                });
            },

            seedFromUrl: function (module) {
                var hashState = moduleObj.shared.getHashValue(module.settings.stateUrlArg);
                var hashPieceCategory = moduleObj.shared.getHashValue(module.settings.pieceCategoryUrlArg);
                var hashCategory = moduleObj.shared.getHashValue(module.settings.categoryUrlArg);
                var hashSubcategory = moduleObj.shared.getHashValue(module.settings.subcategoryUrlArg);
                var hashProduct = moduleObj.shared.getHashValue(module.settings.productUrlArg);
                var hashMaterial = moduleObj.shared.getHashValue(module.settings.materialUrlArg);

                // Nesting these because you cannot select a category without a state, etc etc
                if (!!hashState) {
                    module.$stateDropdownOptionArea.val(hashState);
                    module.$stateDropdownOptionArea.trigger("change");

                    if (!!hashPieceCategory) {
                        module.$pieceCategorySelectorArea.val(hashPieceCategory);
                        module.$pieceCategorySelectorArea.trigger("change");

                        if (!!hashCategory) {
                            module.$categorySelectorArea.val(hashCategory);
                            module.$categorySelectorArea.trigger("change");

                            if (!!hashProduct) {
                                module.$productSelectorArea.val(hashProduct);
                                module.$productSelectorArea.trigger("change");

                                if (!!hashMaterial) {
                                    module.$marketingMaterialSelectorArea.val(hashMaterial);
                                    module.$marketingMaterialSelectorArea.trigger("change");
                                }
                            }
                        }
                    }
                }
            },

            setupStates: function (module) {
                moduleObj.actions.resetStates(module);

                module.$stateDropdownOptionArea.trigger("change");
            },

            setupCategories: function (module) {
                // Data for categories
                var categories = moduleObj.data.pieceCategories;

                // Remove options without forms associated
                categories = _(categories).chain().filter(function (categoryToFilter) {
                    return moduleObj.shared.getApplicableFormsForSelections(moduleObj.data.forms, moduleObj.data.productCategories, moduleObj.data.productOfferings, moduleObj.data.selections.state.guid, undefined, categoryToFilter.guid).length > 0;
                }).sortBy("name").value();

                moduleObj.actions.resetCategories(module);

                for (var x = 0; x < categories.length; x++) {
                    var categorySelectionOptionTemplate = moduleObj.actions.getTemplateFromElement(module.$pieceCategorySelectorTemplate);

                    categorySelectionOptionTemplate = categorySelectionOptionTemplate.replace(/\{0\}/g, categories[x].guid);
                    categorySelectionOptionTemplate = categorySelectionOptionTemplate.replace(/\{1\}/g, categories[x].name);

                    var checkedString = (moduleObj.data.selections.piece == categories[x]) ? "checked" : undefined;
                    categorySelectionOptionTemplate = categorySelectionOptionTemplate.replace(/\{2\}/g, checkedString);

                    module.$pieceCategorySelectorArea.append(categorySelectionOptionTemplate);
                }

                module.$pieceCategorySelectorContainer.removeClass(module.settings.disabledClass);
            },

            setupSubCategories: function (module) {
                // Data for categories
                var categories = moduleObj.data.productCategories;

                // Remove options without forms associated
                categories = _(categories).filter(function (categoryToFilter) {
                    return moduleObj.shared.getApplicableFormsForSelections(moduleObj.data.forms, moduleObj.data.productCategories, moduleObj.data.productOfferings, moduleObj.data.selections.state.guid, undefined, moduleObj.data.selections.piece.guid, categoryToFilter.guid).length > 0;
                });

                moduleObj.actions.resetSubCategories(module);

                for (var x = 0; x < categories.length; x++) {
                    var categorySelectionOptionTemplate = moduleObj.actions.getTemplateFromElement(module.$categorySelectorTemplate);

                    categorySelectionOptionTemplate = categorySelectionOptionTemplate.replace(/\{0\}/g, categories[x].guid);
                    categorySelectionOptionTemplate = categorySelectionOptionTemplate.replace(/\{1\}/g, categories[x].name);

                    var checkedString = (moduleObj.data.selections.category == categories[x]) ? "checked" : undefined;
                    categorySelectionOptionTemplate = categorySelectionOptionTemplate.replace(/\{2\}/g, checkedString);

                    module.$categorySelectorArea.append(categorySelectionOptionTemplate);
                }

                module.$categorySelectorContainer.removeClass(module.settings.disabledClass);
            },

            setupProducts: function (module) {
                var products = _(moduleObj.data.selections.category.terms).chain().pluck("terms").flatten().value();

                // Remove options without forms associated
                products = _(products).chain().filter(function (productToFilter) {
                    return moduleObj.shared.getApplicableFormsForSelections(moduleObj.data.forms, moduleObj.data.productCategories, moduleObj.data.productOfferings, moduleObj.data.selections.state.guid, undefined, moduleObj.data.selections.piece.guid, moduleObj.data.selections.category.guid, productToFilter.guid).length > 0;
                }).sortBy("name").value();

                moduleObj.actions.resetProductOptions(module);

                for (var x = 0; x < products.length; x++) {
                    var itemTemplate = moduleObj.actions.getTemplateFromElement(module.$productSelectorTemplate);

                    itemTemplate = itemTemplate.replace(/\{0\}/g, products[x].guid);
                    itemTemplate = itemTemplate.replace(/\{1\}/g, products[x].name);

                    var checkedString = (moduleObj.data.selections.product == products[x]) ? "checked" : undefined;
                    itemTemplate = itemTemplate.replace(/\{2\}/g, checkedString);

                    module.$productSelectorArea.append(itemTemplate);
                }

                module.$productSelectorContainer.removeClass(module.settings.disabledClass);
            },

            setupMarketingMaterials: function (module) {
                var marketingMaterials = moduleObj.data.selections.applicableForms;

                moduleObj.actions.resetMarketingMaterials(module);

                _(marketingMaterials).each(function (marketingMaterial) {
                    var itemTemplate = moduleObj.actions.getTemplateFromElement(module.$marketingMaterialSelectorItem);

                    itemTemplate = itemTemplate.replace(/\{0\}/g, marketingMaterial.formId);
                    itemTemplate = itemTemplate.replace(/\{1\}/g, marketingMaterial.documentTitle);

                    var checkedString = (moduleObj.data.selections.product == marketingMaterial) ? "checked" : undefined;
                    itemTemplate = itemTemplate.replace(/\{2\}/g, checkedString);

                    module.$marketingMaterialSelectorArea.append(itemTemplate);
                });

                module.$marketingMaterialSelectorContainer.removeClass(module.settings.disabledClass);
                module.$marketingMaterialSelectorContainer.show();
            },

            setupMarketingMaterialSummary: function (module) {
                var selectedMaterial = moduleObj.data.selections.marketingMaterial;

                moduleObj.data.selections.selectedForms = [selectedMaterial];

                moduleObj.actions.resetMarketingMaterialSummary(module);

                var areaTemplate = moduleObj.actions.getTemplateFromElement(module.$materialSummaryAreaItem);

                moduleObj.data.selections.selectedFormIds = selectedMaterial.formId;
                var encodedFormIds = encodeURIComponent(selectedMaterial.formId);
                var formDownloadUrl = module.settings.formsUrlDownloadBase + '?ids=' + encodedFormIds;

                areaTemplate = _.template(areaTemplate)({
                    item: selectedMaterial,
                    downloadUrl: formDownloadUrl
                });

                //areaTemplate = areaTemplate.replace(/\{0\}/g, selectedMaterial.documentTitle);
                //areaTemplate = areaTemplate.replace(/\{1\}/g, selectedMaterial.formNumber);
                //areaTemplate = areaTemplate.replace(/\{4\}/g, selectedMaterial.formId);
                //areaTemplate = areaTemplate.replace(/\{5\}/g, selectedMaterial.thumbnailUrl);

                //if (!!selectedMaterial.documentDescription) {
                //    areaTemplate = areaTemplate.replace(/\{2\}/g, selectedMaterial.documentDescription);
                //} else {
                //    areaTemplate = areaTemplate.replace(/\{2\}/g, "");
                //}

                //areaTemplate = areaTemplate.replace(/\{3\}/g, formDownloadUrl);

                module.$materialSummaryArea.append(areaTemplate);

            },

            resetStates: function (module) {
                moduleObj.actions.resetCategories(module);
            },

            resetCategories: function (module) {
                module.$pieceCategorySelectorArea.empty();

                moduleObj.actions.resetSubCategories(module);
            },

            resetSubCategories: function (module) {
                module.$categorySelectorArea.empty();
                module.$categorySelectorContainer.addClass(module.settings.disabledClass);

                moduleObj.actions.resetProductOptions(module);
            },

            resetProductOptions: function (module) {
                module.$productSelectorArea.empty();
                module.$productSelectorContainer.addClass(module.settings.disabledClass);

                moduleObj.actions.resetMarketingMaterials(module);
            },

            resetMarketingMaterials: function (module) {
                module.$marketingMaterialSelectorArea.empty();

                moduleObj.actions.resetMarketingMaterialSummary(module);
                module.$marketingMaterialSelectorContainer.hide();
            },

            resetMarketingMaterialSummary: function (module) {
                module.$materialSummaryArea.empty();
            },

            registerChangeEvents: function (module) {
                module.$stateDropdownOptionArea.on("change", module, moduleObj.listen.changedStateOption);
                module.$pieceCategorySelectorArea.on("change", module, moduleObj.listen.changedCategoryOption);
                module.$categorySelectorArea.on("change", module, moduleObj.listen.changedSubCategoryOption);
                module.$productSelectorArea.on("change", module, moduleObj.listen.changedProductOption);
                module.$marketingMaterialSelectorArea.on("change", module, moduleObj.listen.changedMarketingMaterialOption);
                module.$element.on("click", "[data-modal].email-forms-button", module, moduleObj.listen.clickedEmailFormModal);
                module.$element.on("click", ".download-forms-button", module, moduleObj.analytics.trackFormDownloadEvent);
            },

            calculateApplicableForms: function (module) {
                moduleObj.data.selections.applicableForms = moduleObj.shared.getApplicableFormsForSelections(moduleObj.data.forms, moduleObj.data.productCategories, moduleObj.data.productOfferings, moduleObj.data.selections.state.guid, undefined, moduleObj.data.selections.piece.guid, moduleObj.data.selections.category.guid, moduleObj.data.selections.product.guid);
            },

            getTemplateFromElement: function ($element, decodeHtml) {
                var elementHtml = $element.html();
                elementHtml = elementHtml.trim();

                elementHtml = elementHtml.replace(/&gt;/g, ">").replace(/&lt;/g, "<");
                return elementHtml;
            },
        }
    }).extend(symetra.marketingModuleBase));

})();;
(function () {
    "use strict";

    var shoppingCartRemoveEvent = 'symetracart.removeitem';
    var shoppingCartAddEvent = 'symetracart.additem';

    var moduleObj = moduler('marketingMaterialsByProduct', _({
        data: {

        },

        defaults: {
            categorySelectorContainer: '[data-section=CategorySelectorContainer]',
            categorySelectorArea: '[data-section=CategorySelectorArea]',
            categorySelectorTemplate: '[data-template=OptionItem]',

            subcategorySelectorContainer: '[data-section=SubCategorySelectorContainer]',
            subcategorySelectorArea: '[data-section=SubCategorySelectorArea]',
            subcategorySelectorTemplate: '[data-template=OptionItem]',

            productSelectorContainer: '[data-section=ProductSelectorContainer]',
            productSelectorArea: '[data-section=ProductSelectorArea]',
            productSelectorTemplate: '[data-template=OptionItem]',

            marketingMaterialSelectorContainer: '[data-section=MarketingMaterialSelectorContainer]',
            marketingMaterialSelectorArea: '[data-section=MarketingMaterialSelectorArea]',
            marketingMaterialSelectorItem: '[data-template=OptionItem]',

            materialSummaryArea: '[data-section=MaterialSummaryArea]',
            materialSummaryAreaItem: '[data-template=MaterialSummaryAreaItem]',

            stateDropdownOptionArea: '[data-section=StateDropdownOptionArea]',
            stateDropdownOptionItemTemplate: '[data-template=OptionItem]',
            stateDropdownDefaultOptionItemTemplate: '[data-template=StateDropdownDefaultOption]',

            requiredFormsCategoryTemplate: '[data-template=RequiredFormsCategory]',
            optionalFormsCategoryTemplate: '[data-template=OptionalFormsCategory]',
            serviceFormsCategoryTemplate: '[data-template=ServiceFormsCategory]',

            disabledClass: 'Box--disabled',
            hideShowToggleClass: 'u-hiddenVisually',
            stateDefaultOptionValue: "NO_STATE_SELECTED",

            // URL Args
            stateUrlArg: "state",
            categoryUrlArg: "category",
            subcategoryUrlArg: "subcategory",
            productUrlArg: "product",
            materialUrlArg: "material",

            // Forms Download URL 
            // TODO: Get From Server
            formsUrlDownloadBase: '/GetForms/',
        },

        init: function (module) {
            module.$categorySelectorContainer = module.$element.find(module.settings.categorySelectorContainer);
            module.$categorySelectorArea = module.$element.find(module.settings.categorySelectorArea);
            module.$categorySelectorTemplate = $(module.settings.categorySelectorTemplate);

            module.$subcategorySelectorContainer = module.$element.find(module.settings.subcategorySelectorContainer);
            module.$subcategorySelectorArea = module.$element.find(module.settings.subcategorySelectorArea);
            module.$subcategorySelectorTemplate = $(module.settings.subcategorySelectorTemplate);

            module.$productSelectorContainer = module.$element.find(module.settings.productSelectorContainer);
            module.$productSelectorArea = module.$element.find(module.settings.productSelectorArea);
            module.$productSelectorTemplate = $(module.settings.productSelectorTemplate);

            module.$stateDropdownOptionArea = module.$element.find(module.settings.stateDropdownOptionArea);
            module.$stateDropdownOptionItemTemplate = $(module.settings.stateDropdownOptionItemTemplate);
            module.$stateDropdownDefaultOptionItemTemplate = $(module.settings.stateDropdownDefaultOptionItemTemplate);

            module.$requiredFormsCategoryTemplate = $(module.settings.requiredFormsCategoryTemplate);
            module.$optionalFormsCategoryTemplate = $(module.settings.optionalFormsCategoryTemplate);
            module.$serviceFormsCategoryTemplate = $(module.settings.serviceFormsCategoryTemplate);
            module.$formsCategoryItemTemplate = $(module.settings.formsCategoryItemTemplate);

            module.$marketingMaterialSelectorContainer = module.$element.find(module.settings.marketingMaterialSelectorContainer);
            module.$marketingMaterialSelectorArea = module.$element.find(module.settings.marketingMaterialSelectorArea);
            module.$marketingMaterialSelectorItem = $(module.settings.marketingMaterialSelectorItem);

            module.$materialSummaryArea = module.$element.find(module.settings.materialSummaryArea);
            module.$materialSummaryAreaItem = $(module.settings.materialSummaryAreaItem);

            module.$materialSummaryArea.on("click", "[data-addtocart]", module, moduleObj.listen.addItemToCart);

            $(document).on("click", ".Modal--wide .email-forms-submit-button", module, moduleObj.analytics.trackFormEmailEvent);

            moduleObj.actions.initializeOptions(module);
        },

        // TODO: Refactor reused Event Category
        analytics: {
            getTypePrefix: function (module) {
                return module.$element.data("block-type") + " ";
            },

            trackStateChange: function (module) {
                var state = moduleObj.data.selections.state;

                if (typeof gtag !== 'undefined' && !!state) {
                    gtag('event', 'Select State', {
                        'event_category': moduleObj.analytics.getTypePrefix(module) + 'MM Download [By Product]',
                        'event_label': state.name + " [" + state.guid + "]"
                    });
                }
            },

            trackProductCategoryChange: function (module) {
                var category = moduleObj.data.selections.category;

                if (typeof gtag !== 'undefined' && !!category) {
                    gtag('event', 'Select Product Category', {
                        'event_category': moduleObj.analytics.getTypePrefix(module) + 'MM Download [By Product]',
                        'event_label': category.name + " [" + category.guid + "]"
                    });
                }
            },

            trackProductSubcategoryChange: function (module) {
                var subcategory = moduleObj.data.selections.subcategory;

                if (typeof gtag !== 'undefined' && !!subcategory) {
                    gtag('event', 'Select Product Subcategory', {
                        'event_category': moduleObj.analytics.getTypePrefix(module) + 'MM Download [By Product]',
                        'event_label': subcategory.name + " [" + subcategory.guid + "]"
                    });
                }
            },

            trackProductChange: function (module) {
                var product = moduleObj.data.selections.product;

                if (typeof gtag !== 'undefined' && !!product) {
                    gtag('event', 'Select Product', {
                        'event_category': moduleObj.analytics.getTypePrefix(module) + 'MM Download [By Product]',
                        'event_label': product.name + " [" + product.guid + "]"
                    });
                }
            },

            trackMarketingMaterialChange: function (module) {
                var marketingMaterial = moduleObj.data.selections.marketingMaterial;

                if (typeof gtag !== 'undefined' && !!marketingMaterial) {
                    gtag('event', 'Select Marketing Material', {
                        'event_category': moduleObj.analytics.getTypePrefix(module) + 'MM Download [By Product]',
                        'event_label': marketingMaterial.documentTitle + " [" + marketingMaterial.formId + "]"
                    });
                }
            },

            trackFormDownloadEvent: mo.event(function (module, event) {
                if (typeof gtag !== 'undefined' && !!moduleObj.data.selections.selectedFormIds && moduleObj.data.selections.selectedFormIds.length > 0) {
                    gtag('event', 'Download Form(s)', {
                        'event_category': moduleObj.analytics.getTypePrefix(module) + 'MM Download [By Product]',
                        'event_label': moduleObj.data.selections.selectedFormIds
                    });
                }
            }),
            
            trackFormEmailEvent: mo.event(function (module, event) {
                if (typeof gtag !== 'undefined' && !!moduleObj.data.selections.selectedFormIds && moduleObj.data.selections.selectedFormIds.length > 0) {
                    gtag('event', 'Emailed Form(s)', {
                        'event_category': moduleObj.analytics.getTypePrefix(module) + 'MM Download [By Product]',
                        'event_label': moduleObj.data.selections.selectedFormIds
                    });
                }
            })
        },

        listen: {
            changedStateOption: mo.event(function (module, event) {
                var $currentTarget = $(event.currentTarget);
                var stateGuid = $currentTarget.val();

                if (stateGuid != null && stateGuid != module.settings.stateDefaultOptionValue) {
                    moduleObj.data.selections.state = _(moduleObj.data.states).findWhere({ guid: stateGuid });

                    moduleObj.analytics.trackStateChange(module);

                    moduleObj.shared.updateUrlHash(moduleObj.data.selections);

                    moduleObj.actions.setupCategories(module);
                } else {
                    moduleObj.actions.resetCategories(module);

                    moduleObj.shared.updateUrlHash(undefined);

                    module.$categorySelectorContainer.addClass(module.settings.disabledClass);
                }
            }),

            changedCategoryOption: mo.event(function (module, event) {
                var $currentTarget = $(event.currentTarget);
                var categoryGuid = $currentTarget.val();

                if (!!categoryGuid) {
                    moduleObj.data.selections.category = _(moduleObj.data.productCategories).findWhere({ guid: categoryGuid });

                    moduleObj.analytics.trackProductCategoryChange(module);

                    moduleObj.actions.setupSubCategories(module);
                }
            }),

            changedSubCategoryOption: mo.event(function (module, event) {
                var $currentTarget = $(event.currentTarget);
                var subcategoryGuid = $currentTarget.val();

                if (!!subcategoryGuid) {
                    moduleObj.data.selections.subcategory = _(moduleObj.data.selections.category.terms).findWhere({ guid: subcategoryGuid });

                    moduleObj.analytics.trackProductSubcategoryChange(module);

                    moduleObj.shared.updateUrlHash(moduleObj.data.selections);

                    moduleObj.actions.setupProducts(module);
                }
            }),

            changedProductOption: mo.event(function (module, event) {
                var $currentTarget = $(event.currentTarget);
                var productGuid = $currentTarget.val();

                if (!!productGuid) {
                    moduleObj.data.selections.product = _(moduleObj.data.selections.subcategory.terms).findWhere({ guid: productGuid });

                    moduleObj.analytics.trackProductChange(module);

                    moduleObj.shared.updateUrlHash(moduleObj.data.selections);

                    moduleObj.actions.calculateApplicableForms(module); // Filters forms used in finding the formActions

                    moduleObj.actions.setupMarketingMaterials(module);
                }
            }),

            changedMarketingMaterialOption: mo.event(function (module, event) {
                var $currentTarget = $(event.currentTarget);
                var materialDocumentId = $currentTarget.val();

                if (!!materialDocumentId) {
                    moduleObj.data.selections.marketingMaterial = _(moduleObj.data.selections.applicableForms).findWhere({ formId: materialDocumentId });

                    moduleObj.analytics.trackMarketingMaterialChange(module);

                    moduleObj.shared.updateUrlHash(moduleObj.data.selections);

                    moduleObj.listen.logDirectUrl(module);

                    moduleObj.actions.calculateApplicableForms(module); // Filters forms used in finding the formActions

                    moduleObj.actions.setupMarketingMaterialSummary(module);
                }
            }),

            logDirectUrl: function (module) {
                var windowLocation = window.location.toString();

                var pagePath = windowLocation;

                if (windowLocation.indexOf("#") != -1) {
                    pagePath = windowLocation.substring(0, windowLocation.indexOf("#"));
                }

                pagePath = pagePath + "#";

                var additionalArgs = "";

                var addToArgs = function (objectTerm, termKey, objectProperty) {
                    if (!!objectTerm) {
                        if (additionalArgs.length != 0) {
                            additionalArgs = additionalArgs + "&";
                        }

                        if (!!objectProperty) {
                            additionalArgs = additionalArgs + termKey + "=" + objectTerm[objectProperty];
                        } else {
                            additionalArgs = additionalArgs + termKey + "=" + objectTerm.guid;
                        }
                    } else {
                        // No term
                        if (!!objectProperty) {
                            additionalArgs = additionalArgs + termKey + "=" + objectProperty;
                        }
                    }
                };

                addToArgs(undefined, "tab", "product");
                addToArgs(moduleObj.data.selections.state, "state");
                addToArgs(moduleObj.data.selections.piece, "piece");
                addToArgs(moduleObj.data.selections.category, "category");
                addToArgs(moduleObj.data.selections.subcategory, "subcategory");
                addToArgs(moduleObj.data.selections.product, "product");
                addToArgs(moduleObj.data.selections.marketingMaterial, "material", "formId");

                console.log(pagePath + additionalArgs);
            },

            addItemToCart: mo.event(function (module, event) {
                event.preventDefault(); // No anchor tag #

                var $target = $(event.currentTarget);
                var $addItemToCartWrapper = $target.parent().parent();

                var $quantityTextField = $addItemToCartWrapper.find("input[type=text]");
                var $validationMessage = $addItemToCartWrapper.find(".quantity-validation-msg");
                $validationMessage.hide();

                var materialId = "" + $target.data("addtocart");
                var quantity = parseInt($quantityTextField.val());

                if (quantity > 0 && quantity <= 50) {
                    $(window).trigger(shoppingCartAddEvent, {
                        item: moduleObj.data.selections.marketingMaterial,
                        quantity: quantity,
                        itemId: moduleObj.data.selections.marketingMaterial.formId
                    });
                } else {
                    // TODO: Display error message from requirements
                    $validationMessage.show();
                }
            }),

            clickedEmailFormModal: mo.event(function (module, event) {
                var $formPanel = $(".email-forms-modal", module.$element);

                $("[data-bind=email-form-formids]").val(moduleObj.data.selections.selectedFormIds);

                var $emailFormSummaryList = $("[data-section=EmailFormsList]");

                var $generatedListSummaryItems = _.map(moduleObj.data.selections.selectedForms, function (form) {
                    var encodedFormIds = encodeURIComponent(form.formId);
                    var formDownloadUrl = module.settings.formsUrlDownloadBase + '?ids=' + encodedFormIds;

                    var $li = $("<li>");

                    var $link = $("<a>");

                    $link.attr("href", formDownloadUrl);
                    $link.text(form.documentTitle);

                    $li.append($link);

                    return $li;
                });

                $emailFormSummaryList.append($generatedListSummaryItems);
            }),
        },

        fn: {
            isSelectedGuid: function (guid) {
                return moduleObj.data.selections.indexOf(guid) != -1;
            }

        },

        actions: {
            initializeOptions: function (module) {
                var pageId = module.$element.data("page-id");
                var blockId = module.$element.data("block-id");

                moduleObj.shared.parseWidgetDataFromJson(pageId, blockId).then(function (blockData) {
                    moduleObj.data = blockData;

                    moduleObj.actions.registerChangeEvents(module);

                    moduleObj.actions.setupStates(module);

                    moduleObj.shared.seedTabFromUrl(module);
                    moduleObj.actions.seedFromUrl(module);
                });
            },

            seedFromUrl: function (module) {
                var hashState = moduleObj.shared.getHashValue(module.settings.stateUrlArg);
                var hashCategory = moduleObj.shared.getHashValue(module.settings.categoryUrlArg);
                var hashSubcategory = moduleObj.shared.getHashValue(module.settings.subcategoryUrlArg);
                var hashProduct = moduleObj.shared.getHashValue(module.settings.productUrlArg);
                var hashMaterial = moduleObj.shared.getHashValue(module.settings.materialUrlArg);

                // Nesting these because you cannot select a category without a state, etc etc
                if (!!hashState) {
                    module.$stateDropdownOptionArea.val(hashState);
                    module.$stateDropdownOptionArea.trigger("change");

                    if (!!hashCategory) {
                        module.$categorySelectorArea.val(hashCategory);
                        module.$categorySelectorArea.trigger("change");

                        if (!!hashSubcategory) {
                            module.$subcategorySelectorArea.val(hashSubcategory);
                            module.$subcategorySelectorArea.trigger("change");

                            if (!!hashProduct) {
                                module.$productSelectorArea.val(hashProduct);
                                module.$productSelectorArea.trigger("change");

                                if (!!hashMaterial) {
                                    module.$marketingMaterialSelectorArea.val(hashMaterial);
                                    module.$marketingMaterialSelectorArea.trigger("change");
                                }
                            }
                        }
                    }
                }
            },

            setupStates: function (module) {
                moduleObj.actions.resetStates(module);

                module.$stateDropdownOptionArea.trigger("change");
            },

            setupCategories: function (module) {
                // Data for categories
                var categories = moduleObj.data.productCategories;

                // Remove options without forms associated
                categories = _(categories).chain().filter(function (categoryToFilter) {
                    return moduleObj.shared.getApplicableFormsForSelections(moduleObj.data.forms, moduleObj.data.productCategories, moduleObj.data.productOfferings, moduleObj.data.selections.state.guid, undefined, undefined, categoryToFilter.guid).length > 0;
                }).sortBy("name").value();

                moduleObj.actions.resetCategories(module);

                for (var x = 0; x < categories.length; x++) {
                    var categorySelectionOptionTemplate = moduleObj.actions.getTemplateFromElement(module.$categorySelectorTemplate);

                    categorySelectionOptionTemplate = categorySelectionOptionTemplate.replace(/\{0\}/g, categories[x].guid);
                    categorySelectionOptionTemplate = categorySelectionOptionTemplate.replace(/\{1\}/g, categories[x].name);

                    var checkedString = (moduleObj.data.selections.category == categories[x]) ? "checked" : undefined;
                    categorySelectionOptionTemplate = categorySelectionOptionTemplate.replace(/\{2\}/g, checkedString);

                    module.$categorySelectorArea.append(categorySelectionOptionTemplate);
                }

                module.$categorySelectorContainer.removeClass(module.settings.disabledClass);
            },

            setupSubCategories: function (module) {
                var subcategories = moduleObj.data.selections.category.terms;

                // Remove options without forms associated
                subcategories = _(subcategories).chain().filter(function (subcategoryToFilter) {
                    return _.any(subcategoryToFilter.terms, function (productTerm) {
                        return moduleObj.shared.getApplicableFormsForSelections(moduleObj.data.forms, moduleObj.data.productCategories, moduleObj.data.productOfferings, moduleObj.data.selections.state.guid, subcategoryToFilter.guid, undefined, moduleObj.data.selections.category.guid, productTerm.guid).length > 0;
                    });
                }).sortBy("name").value();

                moduleObj.actions.resetSubCategories(module);

                for (var x = 0; x < subcategories.length; x++) {
                    var categorySelectionOptionTemplate = moduleObj.actions.getTemplateFromElement(module.$subcategorySelectorTemplate);

                    categorySelectionOptionTemplate = categorySelectionOptionTemplate.replace(/\{0\}/g, subcategories[x].guid);
                    categorySelectionOptionTemplate = categorySelectionOptionTemplate.replace(/\{1\}/g, subcategories[x].name);

                    var checkedString = (moduleObj.data.selections.subcategory == subcategories[x]) ? "checked" : undefined;
                    categorySelectionOptionTemplate = categorySelectionOptionTemplate.replace(/\{2\}/g, checkedString);

                    module.$subcategorySelectorArea.append(categorySelectionOptionTemplate);
                }

                module.$subcategorySelectorContainer.removeClass(module.settings.disabledClass);
            },

            setupProducts: function (module) {
                var products = moduleObj.data.selections.subcategory.terms;

                // Remove options without forms associated
                products = _(products).chain().filter(function (productToFilter) {
                    return moduleObj.shared.getApplicableFormsForSelections(moduleObj.data.forms, moduleObj.data.productCategories, moduleObj.data.productOfferings, moduleObj.data.selections.state.guid, moduleObj.data.selections.subcategory.guid, undefined, moduleObj.data.selections.category.guid, productToFilter.guid).length > 0;
                }).sortBy("name").value();

                moduleObj.actions.resetProductOptions(module);

                for (var x = 0; x < products.length; x++) {
                    var itemTemplate = moduleObj.actions.getTemplateFromElement(module.$productSelectorTemplate);

                    itemTemplate = itemTemplate.replace(/\{0\}/g, products[x].guid);
                    itemTemplate = itemTemplate.replace(/\{1\}/g, products[x].name);

                    var checkedString = (moduleObj.data.selections.product == products[x]) ? "checked" : undefined;
                    itemTemplate = itemTemplate.replace(/\{2\}/g, checkedString);

                    module.$productSelectorArea.append(itemTemplate);
                }

                module.$productSelectorContainer.removeClass(module.settings.disabledClass);
            },

            setupMarketingMaterials: function (module) {
                var marketingMaterials = moduleObj.data.selections.applicableForms;

                moduleObj.actions.resetMarketingMaterials(module);

                _(marketingMaterials).each(function (marketingMaterial) {
                    var itemTemplate = moduleObj.actions.getTemplateFromElement(module.$marketingMaterialSelectorItem);

                    itemTemplate = itemTemplate.replace(/\{0\}/g, marketingMaterial.formId);
                    itemTemplate = itemTemplate.replace(/\{1\}/g, marketingMaterial.documentTitle);

                    var checkedString = (moduleObj.data.selections.product == marketingMaterial) ? "checked" : undefined;
                    itemTemplate = itemTemplate.replace(/\{2\}/g, checkedString);

                    module.$marketingMaterialSelectorArea.append(itemTemplate);
                });

                module.$marketingMaterialSelectorContainer.removeClass(module.settings.disabledClass);
                module.$marketingMaterialSelectorContainer.show();
            },

            setupMarketingMaterialSummary: function (module) {
                var selectedMaterial = moduleObj.data.selections.marketingMaterial;

                moduleObj.data.selections.selectedForms = [selectedMaterial];

                moduleObj.actions.resetMarketingMaterialSummary(module);

                var areaTemplate = moduleObj.actions.getTemplateFromElement(module.$materialSummaryAreaItem);

                moduleObj.data.selections.selectedFormIds = selectedMaterial.formId;

                var encodedFormIds = encodeURIComponent(selectedMaterial.formId);
                var formDownloadUrl = module.settings.formsUrlDownloadBase + '?ids=' + encodedFormIds;

                areaTemplate = _.template(areaTemplate)({
                    item: selectedMaterial,
                    downloadUrl: formDownloadUrl
                });

                module.$materialSummaryArea.append(areaTemplate);

            },

            resetStates: function (module) {
                moduleObj.actions.resetCategories(module);
            },

            resetCategories: function (module) {
                module.$categorySelectorArea.empty();

                moduleObj.actions.resetSubCategories(module);
            },

            resetSubCategories: function (module) {
                module.$subcategorySelectorArea.empty();
                module.$subcategorySelectorContainer.addClass(module.settings.disabledClass);

                moduleObj.actions.resetProductOptions(module);
            },

            resetProductOptions: function (module) {
                module.$productSelectorArea.empty();
                module.$productSelectorContainer.addClass(module.settings.disabledClass);

                moduleObj.actions.resetMarketingMaterials(module);
            },

            resetMarketingMaterials: function (module) {
                module.$marketingMaterialSelectorArea.empty();

                moduleObj.actions.resetMarketingMaterialSummary(module);
                module.$marketingMaterialSelectorContainer.hide();
            },

            resetMarketingMaterialSummary: function (module) {
                module.$materialSummaryArea.empty();
            },

            registerChangeEvents: function (module) {
                module.$stateDropdownOptionArea.on("change", module, moduleObj.listen.changedStateOption); // module.$stateDropdownOptionArea
                module.$categorySelectorArea.on("change", module, moduleObj.listen.changedCategoryOption); // module.$categorySelectorArea
                module.$subcategorySelectorArea.on("change", module, moduleObj.listen.changedSubCategoryOption); // module.$subcategorySelectorArea
                module.$productSelectorArea.on("change", module, moduleObj.listen.changedProductOption); // module.$productSelectorArea
                module.$marketingMaterialSelectorArea.on("change", module, moduleObj.listen.changedMarketingMaterialOption);
                module.$element.on("click", "[data-modal].email-forms-button", module, moduleObj.listen.clickedEmailFormModal);
                module.$element.on("click", ".download-forms-button", module, moduleObj.analytics.trackFormDownloadEvent);
            },

            calculateApplicableForms: function (module) {
                moduleObj.data.selections.applicableForms = moduleObj.shared.getApplicableFormsForSelections(moduleObj.data.forms, moduleObj.data.productCategories, moduleObj.data.productOfferings, moduleObj.data.selections.state.guid, moduleObj.data.selections.subcategory.guid, undefined, moduleObj.data.selections.category.guid, moduleObj.data.selections.product.guid);
            },

            getTemplateFromElement: function ($element, decodeHtml) {
                var elementHtml = $element.html();
                elementHtml = elementHtml.trim();

                elementHtml = elementHtml.replace(/&gt;/g, ">").replace(/&lt;/g, "<");

                return elementHtml;
            },
        }
    }).extend(symetra.marketingModuleBase));

})();;
/*
 * Cart is not stored serverside (no sessions), so I'm using HTML5 LocalStorage with fallback for non-HTML5 (unable to refresh page without HTML5)
 */

(function () {
    "use strict";

    var shoppingCartRemovedEvent = 'symetracart.itemremoved';
    var shoppingCartRemoveEvent = 'symetracart.removeitem';

    var shoppingCartAddedEvent = 'symetracart.itemadded';
    var shoppingCartAddEvent = 'symetracart.additem';

    var shoppingCartStorageKey = 'SymetraShoppingCart';

    var globalShoppingCart = {
        nonHtml5Cart: [],

        addItemToCart: function (event, cartItem) {
            var cart = globalShoppingCart.getShoppingCartData();
            var removed = false;

            var existingItem = _(cart).findWhere({
                itemId: cartItem.itemId
            });

            if (!!existingItem) {
                if (cartItem.quantity > 0) {
                    existingItem.quantity = cartItem.quantity;
                } else {
                    cart = _(cart).without(existingItem);
                    removed = true;
                }
            } else {
                cart.push(cartItem);
            }

            globalShoppingCart.saveShoppingCart(cart);

            if (removed) {
                $(window).trigger(shoppingCartRemovedEvent);
            } else {
                $(window).trigger(shoppingCartAddedEvent);
            }
        },

        removeItem: function (cartItemId) {
            var cart = globalShoppingCart.getShoppingCartData();

            var existingItem = _(cart).findWhere({
                itemId: cartItemId
            });

            if (!!existingItem) {
                existingItem.quantity = 0;
                globalShoppingCart.addItemToCart(undefined, existingItem);
            }
        },

        getShoppingCartData: function () {
            if (!!window.localStorage) {
                var cartInStorage = window.localStorage.getItem(shoppingCartStorageKey);

                if (cartInStorage == undefined)
                    cartInStorage = JSON.stringify([]);

                try {
                    cartInStorage = JSON.parse(cartInStorage);
                } catch (err) {
                    cartInStorage = [];
                }

                return cartInStorage;
            }

            return globalShoppingCart.nonHtml5Cart;
        },

        saveShoppingCart: function (cart) {
            if (!!window.localStorage) {
                window.localStorage.setItem(shoppingCartStorageKey, JSON.stringify(cart));
            }

            globalShoppingCart.nonHtml5Cart = cart;
        }
    };

    $(window).on(shoppingCartAddEvent, globalShoppingCart.addItemToCart);

    var moduleObj = moduler('marketingMaterialsShoppingCart', {

        defaults: {
            shoppingCartArea: '[data-template=ShoppingCartArea]',
            shoppingCartAreaItem: '[data-template=ShoppingCartAreaItem]',

            removeItemSelector: '[data-remove]',
        },

        listen: {
            clickedRemoveItem: mo.event(function (module, event) {
                event.preventDefault();
                var $currentTarget = $(event.currentTarget);
                var cartItemId = $currentTarget.data("remove");

                globalShoppingCart.removeItem(cartItemId);
            })
        },

        init: function (module) {
            module.$shoppingCartArea = $(module.settings.shoppingCartArea);
            module.$shoppingCartAreaItem = $(module.settings.shoppingCartAreaItem);

            module.$element.on("click", module.settings.removeItemSelector, module, moduleObj.listen.clickedRemoveItem);

            moduleObj.setupDisplay(module);

            
            $(window).on("shoppingcartclear", function () {
                moduleObj.setupDisplay(module, true);

                moduleObj.showCart(module, true);
            });


            $(window).on(shoppingCartAddedEvent, function () {
                moduleObj.setupDisplay(module, true);

                moduleObj.showCart(module, true);
            });

            $(window).on(shoppingCartRemovedEvent, function () {
                moduleObj.setupDisplay(module);

                moduleObj.showCart(module, false);
            });
        },

        setupDisplay: function (module, shouldFlashCart) {
            var $cartAreaDisplayTemplate = moduleObj.getTemplateFromElement(module.$shoppingCartArea);
            var $cartAreaItemDisplayTemplate = moduleObj.getTemplateFromElement(module.$shoppingCartAreaItem);

            var cart = moduleObj.getShoppingCartData(module);

            var templatedString = _.template($cartAreaDisplayTemplate);

            module.$element.html(templatedString({ cart: cart }));

            // Child Items
            templatedString = _.template($cartAreaItemDisplayTemplate);

            var htmlForAllChildren = _(cart).map(templatedString);

            module.$element.find("tbody").html(htmlForAllChildren);

            symetra.shoppingCart.init();

            if (cart.length == 0) {
                module.$element.find(".not-empty").hide();
            } else {
                module.$element.find(".empty").hide();
            }
        },

        getShoppingCartData: function (module) {
            return globalShoppingCart.getShoppingCartData();
        },

        showCart: function (module, animate) {
            var $cart = module.$element.find('.Shoppingcart,.Shoppingcart-tooltip');

            if (animate) {
                $cart.fadeIn().delay(3000).fadeOut();
            } else {
                $cart.show();
            }
        },

        getTemplateFromElement: function ($element) {
            var elementHtml = _.unescape($element.html());
            elementHtml = elementHtml.trim();

            return elementHtml;
        }
    });

    var cartModule = moduler('symetraFullCartDisplay', {
        defaults: {
            hiddenCartDataFieldSelector: '[data-variable=cartContents]'
        },

        init: function (module) {
            cartModule.initializeEvents(module);

            cartModule.displayCart(module);

            $(window).on(shoppingCartAddedEvent, function () {
                cartModule.displayCart(module);
            });

            $(window).on(shoppingCartRemovedEvent, function () {
                cartModule.displayCart(module);
            });
        },

        initializeEvents: function (module) {
            module.$element.on("click", "[data-update-quantity]", module, cartModule.clickedUpdateQuantity);
            module.$element.on("click", "[data-remove]", module, cartModule.clickedRemoveButton);
            module.$element.on("focusin", "[data-cart-item-id]", module, cartModule.clearQuantityChangedLabels);
        },

        clearQuantityChangedLabels: mo.event(function (module, event) {
            module.$element.find(".quantity-changed-msg").hide();
            module.$element.find(".quantity-validation-msg").hide();
        }),

        displayCart: function (module) {
            var cart = globalShoppingCart.getShoppingCartData();

            if (cart.length > 0) {
                var cartTemplate = cartModule.getTemplateFromElement($("[data-template=cart]"));

                cartTemplate = _.template(cartTemplate)({
                    items: cart
                });

                var simpleCartItems = _.map(cart, function (cartItem) {
                    return {
                        itemId: cartItem.itemId,
                        quantity: cartItem.quantity
                    };
                });


                module.$element.html(cartTemplate);

                // We can't look module-relative for the data field because the modal plugin pulls the form to the bottom/top of the body
                module.$hiddenCartDataField = $(module.settings.hiddenCartDataFieldSelector);
                module.$hiddenCartDataField.val(JSON.stringify(simpleCartItems));

                // Replace Module HTML with Templated

                var cartItemHtml = _(cart).map(function (cartItem) {
                    var cartItemTemplate = cartModule.getTemplateFromElement($("[data-template=CartItemTemplate]"));

                    cartItemTemplate = _.template(cartItemTemplate)(cartItem);

                    return cartItemTemplate;
                });

                module.$element.find("[data-section=CartItemArea]").html(cartItemHtml);
            } else {
                var cartTemplate = cartModule.getTemplateFromElement($("[data-template=emptycart]"));
                module.$element.html(cartTemplate);

                // We can't look module-relative for the data field because the modal plugin pulls the form to the bottom/top of the body
                module.$hiddenCartDataField = $(module.settings.hiddenCartDataFieldSelector);
                module.$hiddenCartDataField.val([]);
            }
        },

        clickedUpdateQuantity: mo.event(function (module, event) {
            event.preventDefault();

            // Reset all quantity messages
            module.$element.find(".quantity-changed-msg").hide();

            var $currentTarget = $(event.currentTarget);
            var quantityValidationMessage = $currentTarget.siblings(".quantity-validation-msg");
            var successfullyAddedMessage = $currentTarget.siblings(".quantity-changed-msg");

            var $siblingTextInput = $currentTarget.siblings("[data-cart-item-id]");

            var cartItemId = $siblingTextInput.data("cart-item-id");
            var newQuantity = parseInt($siblingTextInput.val());

            quantityValidationMessage.hide();

            if (!isNaN(newQuantity) && (newQuantity > 0 && newQuantity <= 50)) {
                var cart = globalShoppingCart.getShoppingCartData();

                var existingItem = _(cart).findWhere({ itemId: cartItemId });

                $(window).trigger(shoppingCartAddEvent, {
                    item: existingItem.item,
                    quantity: newQuantity,
                    itemId: cartItemId
                });

                var $changedQuantityMessage = module.$element.find("[data-cart-item-id=" + cartItemId + "]").siblings(".quantity-changed-msg");
                $changedQuantityMessage.show();
            } else {
                quantityValidationMessage.show();
            }
        }),

        clickedRemoveButton: mo.event(function (module, event) {
            var $currentTarget = $(event.currentTarget);
            var cartItemId = $currentTarget.data("remove");

            if (!isNaN(cartItemId)) {
                globalShoppingCart.removeItem(cartItemId);
            }
        }),

        getTemplateFromElement: function ($element) {
            var elementHtml = _.unescape($element.html());
            elementHtml = elementHtml.trim();

            return elementHtml;
        }
    });

})();;
(function () {
    "use strict";

    var moduleObj = moduler('taxYieldCalculator', {
        defaults: {
            box1a: '[data-field=1a]',
            box1b: '[data-field=1b]',
            box1c: '[data-field=1c]',

            box2a: '[data-field=2a]',
            box2b: '[data-field=2b]',
            box2c: '[data-field=2c]'
        },

        data: {},

        init: function (module) {
            module.$box1a = module.$element.find(module.settings.box1a);
            module.$box1b = module.$element.find(module.settings.box1b);
            module.$box1c = module.$element.find(module.settings.box1c);

            module.$box2a = module.$element.find(module.settings.box2a);
            module.$box2b = module.$element.find(module.settings.box2b);
            module.$box2c = module.$element.find(module.settings.box2c);

            moduleObj.initEvents(module);
        },

        initEvents: function (module) {
            module.$box1a.on("keyup", module, moduleObj.actions.updateTaxRate);
            module.$box1b.on("keyup", module, moduleObj.actions.updateTaxRate);
            module.$box2a.on("keyup", module, moduleObj.actions.updateTaxRate);
            module.$box2b.on("keyup", module, moduleObj.actions.updateTaxRate);

            moduleObj.data.taxRateOldValue = module.$box1b.val();

            moduleObj.data.investmentRateOfReturnOldValue = module.$box1a.val();
            moduleObj.data.taxDeferredRateOfReturnOldValue = module.$box2a.val();

        },

        actions: {
            triggerAllRecalculate: function (module) {
                module.$box1a.trigger("keyup");
                module.$box2a.trigger("keyup");
            },

            calculateTopSection: mo.event(function (module, event) {
                var val1a = moduleObj.actions.getFieldValue(module.$box1a);
                var val1b = moduleObj.actions.getFieldValue(module.$box1b);

                var boxValue = (val1a * (1 - val1b)) * 100;

                if (isNaN(boxValue)) {
                    module.$box1c.html("");
                } else {
                    module.$box1c.html(boxValue.toFixed(2));
                }
            }),

            calculateBottomSection: mo.event(function (module, event) {
                // Formula from Symetra:
                // Box 2a / [1- 2b]
                var val2a = moduleObj.actions.getFieldValue(module.$box2a);
                var val2b = moduleObj.actions.getFieldValue(module.$box2b);

                var boxValue = (val2a / (1 - val2b)) * 100;

                if (isNaN(boxValue)) {
                    module.$box2c.html("");
                } else {
                    module.$box2c.html(boxValue.toFixed(2));
                }
            }),

            updateTaxRate: mo.event(function (module, event) {
                var tmprate;

                var synchronizeTaxRateBoxes = function (newValue) {
                    //move tax rate to Pre and After tax fields
                    module.$box2b.val(newValue);
                    module.$box1b.val(newValue);
                };

                tmprate = module.$box1a.val();
                if (isNaN(tmprate) || tmprate < 0 || tmprate > 40) {
                    alert("The TAXABLE YIELD should be a number between 1 and 40.");
                    module.$box1a.focus().select();
                    return false;
                }

                tmprate = module.$box2a.val();
                if (isNaN(tmprate) || tmprate < 1 || tmprate > 40) {
                    alert("The TAX-DEFERRED PRODUCT RATE OF RETURN should be a number between 1 and 40.");
                    module.$box2a.focus().select();
                    return true;
                }


                var changedTopTaxRate = event.currentTarget == module.$box1b[0];
                var changedBottomTaxRate = event.currentTarget == module.$box2b[0];

                if (changedTopTaxRate || changedBottomTaxRate) {
                    tmprate = module.$box1b.val();

                    if (changedTopTaxRate) {
                        if (isNaN(tmprate) || tmprate < 0 || tmprate > 60) {
                            alert("YOUR TAX RATE should be a number between 0 and 60.");
                            module.$box1b.focus().select();
                            return false;
                        }
                        synchronizeTaxRateBoxes(module.$box1b.val());
                    }

                    if (changedBottomTaxRate) {
                        tmprate = module.$box2b.val();
                        if (isNaN(tmprate) || tmprate < 0 || tmprate > 60) {
                            alert("YOUR TAX RATE(2) should be a number between 0 and 60.");
                            module.$box2b.focus().select();
                            return false;
                        }
                        synchronizeTaxRateBoxes(module.$box2b.val());
                    }
                }


                moduleObj.actions.calculateTopSection(module, event);
                moduleObj.actions.calculateBottomSection(module, event);
            }),

            getFieldValue: function ($field) {
                var actualVal = $field.val();

                if (!!actualVal)
                    return parseFloat(actualVal) / 100;

                return 0;
            }
        }
    });

})();

/*

function calcAfterTax(e) {
    var tmprate;
    //validate field1
    tmprate = $(".TaxableYield").val();
    if (!isNaN(tmprate) && (tmprate >= 1) && (tmprate <= 40)) {
        rate1 = $(".TaxableYield").val();
    }
    else {
        alert("The TAXABLE YIELD should be a number between 1 and 40.");
        $(".TaxableYield").focus().select();
        return false;
    }

    //validate field2
    tmprate = $(".PreTaxRate").val();
    if (!isNaN(tmprate) && (tmprate >= 0) && (tmprate <= 60)) {
        rate2 = $(".PreTaxRate").val();
        $(".PostTaxRate").val($(".PreTaxRate").val());  //move tax rate to Pre and After tax fields
    }
    else {
        alert("YOUR TAX RATE should be a number between 0 and 60.");
        $(".PreTaxRate").focus().select();
        return false;
    }

    rate3 = ((1 - (rate2 / 100)) * (rate1 / 100)) * 100;

    //recalculate PreTax just in tax rate has been changed
    rate4 = $(".RateofReturn").val();
    rate5 = $(".PostTaxRate").val();
    rate6 = ((rate4 / 100) / (1 - (rate5 / 100))) * 100

    $(".AfterTaxYield").val(rate3.toFixed(2));
    $(".EquivRateofReturn").val(rate6.toFixed(2));
}

function calcPreTax(e) {
    var tmprate;
    //validate field4
    tmprate = $(".RateofReturn").val();
    if (!isNaN(tmprate) && (tmprate >= 1) && (tmprate <= 40)) {
        rate4 = $(".RateofReturn").val();
    }
    else {
        alert("The TAX-DEFERRED PRODUCT RATE OF RETURN should be a number between 1 and 40.");
        $(".RateofReturn").focus().select();
        return true;
    }

    //validate field5
    tmprate = $(".PostTaxRate").val();
    if (!isNaN(tmprate) && (tmprate >= 0) && (tmprate <= 60)) {
        rate5 = $(".PostTaxRate").val();
        $(".PreTaxRate").val($(".PostTaxRate").val());  //move tax rate to Pre and After tax fields
    }
    else {
        alert("YOUR TAX RATE(2) should be a number between 0 and 60.");
        $(".PostTaxRate").focus().select();
        return false;
    }
    rate6 = ((rate4 / 100) / (1 - (rate5 / 100))) * 100;

    //recalculate AfterTax just in case tax rate has been changed
    rate1 = $(".TaxableYield").val();
    rate2 = $(".PreTaxRate").val();
    rate3 = ((1 - (rate2 / 100)) * (rate1 / 100)) * 100;

    $(".EquivRateofReturn").val(rate6.toFixed(2));
    $(".AfterTaxYield").val(rate3.toFixed(2));
}

*/;
(function () {
    "use strict";

    var moduleObj = moduler('modal-block', {
        
        closeModalElementClass: '.ModalBlock__heading__close',
        modalInvokerClass: '.modal-invoker',
        hiddenClass: 'hidden',
        modalBlockContainerClass: '.ModalBlock__container',

        init: function (module) {
            module.$modalId = module.$element.data('modalId');

            module.$moduleElement = module.$element.find('#' + module.$modalId);

            module.$element
                .find(moduleObj.closeModalElementClass)
                .on("click", module, moduleObj.hideModal);
            module.$element
                .find(moduleObj.modalInvokerClass)
                .on("click", module, moduleObj.showModal);
        },

        showModal: mo.event(function (module, event) {
            event.stopPropagation();
            module.$moduleElement.removeClass(moduleObj.hiddenClass);

            $('body').on("click", module, moduleObj.hideModalGlobal);
        }),

        hideModal: mo.event(function (module, event) {
            module.$moduleElement.addClass(moduleObj.hiddenClass);

            $('body').off("click", module, moduleObj.hideModalGlobal);
        }),

        hideModalGlobal: mo.event(function (module, event) {
            if(!$(event.target).closest(moduleObj.modalBlockContainerClass).length && 
               !$(event.target).is(moduleObj.modalBlockContainerClass)) {
                module.$moduleElement.addClass(moduleObj.hiddenClass);
              }
        }),
    });

})();;
