Mon Sep 19 2016
Copied to clipboard! Copy reply
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • 180
  • 181
  • 182
  • 183
  • 184
  • 185
  • 186
  • 187
  • 188
  • 189
  • 190
  • 191
  • 192
  • 193
  • 194
  • 195
  • 196
  • 197
  • 198
  • 199
  • 200
  • 201
  • 202
  • 203
  • 204
  • 205
  • 206
  • 207
  • 208
  • 209
  • 210
  • 211
  • 212
  • 213
  • 214
  • 215
  • 216
  • 217
  • 218
  • 219
  • 220
  • 221
  • 222
  • 223
  • 224
  • 225
  • 226
  • 227
  • 228
  • 229
  • 230
  • 231
  • 232
  • 233
  • 234
  • 235
  • 236
  • 237
  • 238
  • 239
  • 240
  • 241
  • 242
  • 243
  • 244
  • 245
  • 246
  • 247
  • 248
  • 249
  • 250
  • 251
  • 252
  • 253
  • 254
  • 255
  • 256
  • 257
  • 258
  • 259
  • 260
  • 261
  • 262
  • 263
  • 264
  • 265
  • 266
  • 267
  • 268
  • 269
  • 270
  • 271
  • 272
  • 273
  • 274
  • 275
  • 276
  • 277
  • 278
  • 279
  • 280
  • 281
  • 282
  • 283
  • 284
  • 285
  • 286
  • 287
  • 288
  • 289
  • 290
  • 291
  • 292
  • 293
  • 294
  • 295
  • 296
  • 297
  • 298
  • 299
  • 300
  • 301
  • 302
  • 303
  • 304
  • 305
  • 306
  • 307
  • 308
  • 309
  • 310
  • 311
  • 312
  • 313
  • 314
  • 315
  • 316
  • 317
  • 318
  • 319
  • 320
  • 321
  • 322
  • 323
  • 324
  • 325
  • 326
  • 327
  • 328
  • 329
  • 330
  • 331
  • 332
  • 333
  • 334
  • 335
  • 336
  • 337
  • 338
  • 339
  • 340
  • 341
  • 342
  • 343
  • 344
  • 345
  • 346
  • 347
  • 348
  • 349
  • 350
  • 351
  • 352
  • 353
  • 354
  • 355
  • 356
  • 357
  • 358
  • 359
  • 360
  • 361
  • 362
  • 363
  • 364
  • 365
  • 366
  • 367
  • 368
  • 369
  • 370
  • 371
  • 372
  • 373
  • 374
  • 375
  • 376
  • 377
  • 378
  • 379
  • 380
  • 381
  • 382
  • 383
  • 384
  • 385
  • 386
  • 387
  • 388
  • 389
  • 390
  • 391
  • 392
  • 393
  • 394
  • 395
  • 396
  • 397
  • 398
  • 399
  • 400
  • 401
  • 402
  • 403
  • 404
  • 405
  • 406
  • 407
  • 408
  • 409
  • 410
  • 411
  • 412
  • 413
  • 414
  • 415
  • 416
  • 417
  • 418
  • 419
  • 420
  • 421
  • 422
  • 423
  • 424
  • 425
  • 426
  • 427
  • 428
  • 429
  • 430
  • 431
  • 432
  • 433
  • 434
  • 435
  • 436
  • 437
  • 438
  • 439
  • 440
  • 441
  • 442
  • 443
  • 444
  • 445
  • 446
  • 447
  • 448
  • 449
  • 450
  • 451
  • 452
  • 453
  • 454
  • 455
  • 456
  • 457
  • 458
  • 459
  • 460
  • 461
  • 462
  • 463
  • 464
  • 465
  • 466
  • 467
  • 468
  • 469
  • 470
  • 471
  • 472
  • 473
  • 474
  • 475
  • 476
  • 477
  • 478
  • 479
  • 480
  • 481
  • 482
  • 483
  • 484
  • 485
  • 486
  • 487
  • 488
  • 489
  • 490
  • 491
  • 492
  • 493
  • 494
  • 495
  • 496
  • 497
  • 498
  • 499
  • 500
  • 501
  • 502
  • 503
  • 504
  • 505
  • 506
  • 507
  • 508
  • 509
  • 510
  • 511
  • 512
  • 513
  • 514
  • 515
  • 516
  • 517
  • 518
  • 519
  • 520
  • 521
  • 522
  • 523
  • 524
  • 525
  • 526
  • 527
  • 528
  • 529
  • 530
  • 531
  • 532
  • 533
  • 534
  • 535
  • 536
  • 537
  • 538
  • 539
  • 540
  • 541
  • 542
  • 543
  • 544
  • 545
  • 546
  • 547
  • 548
  • 549
  • 550
  • 551
  • 552
  • 553
  • 554
  • 555
  • 556
  • 557
  • 558
  • 559
  • 560
  • 561
  • 562
  • 563
  • 564
  • 565
  • 566
  • 567
  • 568
  • 569
  • 570
  • 571
  • 572
  • 573
  • 574
  • 575
  • 576
  • 577
  • 578
  • 579
  • 580
  • 581
  • 582
  • 583
  • 584
  • 585
  • 586
  • 587
  • 588
  • 589
  • 590
  • 591
  • 592
  • 593
  • 594
  • 595
  • 596
  • 597
  • 598
  • 599
  • 600
  • 601
  • 602
  • 603
  • 604
  • 605
  • 606
  • 607
  • 608
  • 609
  • 610
  • 611
  • 612
  • 613
  • 614
  • 615
  • 616
  • 617
  • 618
  • 619
  • 620
  • 621
  • 622
  • 623
  • 624
  • 625
  • 626
  • 627
  • 628
  • 629
  • 630
  • 631
  • 632
  • 633
  • 634
  • 635
  • 636
  • 637
  • 638
  • 639
  • 640
  • 641
  • 642
  • 643
  • 644
  • 645
  • 646
  • 647
  • 648
  • 649
  • 650
  • 651
  • 652
  • 653
  • 654
  • 655
  • 656
  • 657
  • 658
  • 659
  • 660
  • 661
  • 662
  • 663
  • 664
  • 665
  • 666
  • 667
  • 668
  • 669
  • 670
  • 671
  • 672
  • 673
  • 674
  • 675
  • 676
  • 677
  • 678
  • 679
  • 680
  • 681
  • 682
  • 683
  • 684
  • 685
  • 686
  • 687
  • 688
  • 689
  • 690
  • 691
  • 692
  • 693
  • 694
  • 695
  • 696
  • 697
  • 698
  • 699
  • 700
  • 701
  • 702
  • 703
  • 704
  • 705
  • 706
  • 707
  • 708
  • 709
  • 710
  • 711
  • 712
  • 713
  • 714
  • 715
  • 716
  • 717
  • 718
  • 719
  • 720
  • 721
  • 722
  • 723
  • 724
  • 725
  • 726
  • 727
  • 728
  • 729
  • 730
  • 731
  • 732
  • 733
  • 734
  • 735
  • 736
  • 737
  • 738
  • 739
  • 740
  • 741
  • 742
  • 743
  • 744
  • 745
  • 746
  • 747
  • 748
  • 749
  • 750
  • 751
  • 752
  • 753
  • 754
  • 755
  • 756
  • 757
  • 758
  • 759
  • 760
  • 761
  • 762
  • 763
  • 764
  • 765
  • 766
  • 767
  • 768
  • 769
  • 770
  • 771
  • 772
  • 773
  • 774
  • 775
  • 776
  • 777
  • 778
  • 779
  • 780
  • 781
  • 782
  • 783
  • 784
  • 785
  • 786
  • 787
  • 788
  • 789
  • 790
  • 791
  • 792
  • 793
  • 794
  • 795
  • 796
  • 797
  • 798
  • 799
  • 800
  • 801
  • 802
  • 803
  • 804
  • 805
  • 806
  • 807
  • 808
  • 809
  • 810
  • 811
  • 812
  • 813
  • 814
  • 815
  • 816
  • 817
  • 818
  • 819
  • 820
  • 821
  • 822
  • 823
  • 824
  • 825
  • 826
  • 827
  • 828
  • 829
  • 830
  • 831
  • 832
  • 833
  • 834
  • 835
  • 836
  • 837
  • 838
  • 839
  • 840
  • 841
  • 842
  • 843
  • 844
  • 845
  • 846
  • 847
  • 848
  • 849
  • 850
  • 851
  • 852
  • 853
  • 854
  • 855
  • 856
  • 857
  • 858
  • 859
  • 860
  • 861
  • 862
  • 863
  • 864
  • 865
  • 866
  • 867
  • 868
  • 869
  • 870
  • 871
  • 872
  • 873
  • 874
  • 875
  • 876
  • 877
  • 878
  • 879
  • 880
  • 881
  • 882
  • 883
  • 884
  • 885
  • 886
  • 887
  • 888
  • 889
  • 890
  • 891
  • 892
  • 893
  • 894
  • 895
  • 896
  • 897
  • 898
  • 899
  • 900
  • 901
  • 902
  • 903
  • 904
  • 905
  • 906
  • 907
  • 908
  • 909
  • 910
  • 911
  • 912
  • 913
  • 914
  • 915
  • 916
  • 917
  • 918
  • 919
  • 920
  • 921
  • 922
  • 923
  • 924
  • 925
  • 926
  • 927
  • 928
  • 929
  • 930
  • 931
  • 932
  • 933
  • 934
  • 935
  • 936
  • 937
  • 938
  • 939
  • 940
  • 941
  • 942
  • 943
  • 944
  • 945
  • 946
  • 947
  • 948
  • 949
  • 950
  • 951
  • 952
  • 953
  • 954
  • 955
  • 956
  • 957
  • 958
  • 959
  • 960
  • 961
  • 962
  • 963
  • 964
  • 965
  • 966
  • 967
  • 968
  • 969
  • 970
  • 971
  • 972
  • 973
  • 974
  • 975
  • 976
  • 977
  • 978
  • 979
  • 980
  • 981
  • 982
  • 983
  • 984
  • 985
  • 986
  • 987
  • 988
  • 989
  • 990
  • 991
  • 992
  • 993
  • 994
  • 995
  • 996
  • 997
  • 998
  • 999
  • 1000
  • 1001
  • 1002
  • 1003
  • 1004
  • 1005
  • 1006
  • 1007
  • 1008
  • 1009
  • 1010
  • 1011
  • 1012
  • 1013
  • 1014
  • 1015
  • 1016
  • 1017
  • 1018
  • 1019
  • 1020
  • 1021
  • 1022
  • 1023
  • 1024
  • 1025
  • 1026
  • 1027
  • 1028
  • 1029
  • 1030
  • 1031
  • 1032
  • 1033
  • 1034
  • 1035
  • 1036
  • 1037
  • 1038
  • 1039
  • 1040
  • 1041
  • 1042
  • 1043
  • 1044
  • 1045
  • 1046
  • 1047
  • 1048
  • 1049
  • 1050
  • 1051
  • 1052
  • 1053
  • 1054
  • 1055
  • 1056
  • 1057
  • 1058
  • 1059
  • 1060
  • 1061
  • 1062
  • 1063
  • 1064
  • 1065
  • 1066
  • 1067
  • 1068
  • 1069
  • 1070
  • 1071
  • 1072
  • 1073
  • 1074
  • 1075
  • 1076
  • 1077
  • 1078
  • 1079
  • 1080
  • 1081
  • 1082
  • 1083
  • 1084
  • 1085
  • 1086
  • 1087
  • 1088
  • 1089
  • 1090
  • 1091
  • 1092
  • 1093
  • 1094
  • 1095
  • 1096
  • 1097
  • 1098
  • 1099
  • 1100
  • 1101
  • 1102
  • 1103
  • 1104
  • 1105
  • 1106
  • 1107
  • 1108
  • 1109
  • 1110
  • 1111
  • 1112
  • 1113
  • 1114
  • 1115
  • 1116
  • 1117
  • 1118
  • 1119
  • 1120
  • 1121
  • 1122
  • 1123
  • 1124
  • 1125
  • 1126
  • 1127
  • 1128
  • 1129
  • 1130
  • 1131
  • 1132
  • 1133
  • 1134
  • 1135
  • 1136
  • 1137
  • 1138
  • 1139
  • 1140
  • 1141
  • 1142
  • 1143
  • 1144
  • 1145
  • 1146
  • 1147
  • 1148
  • 1149
  • 1150
  • 1151
  • 1152
  • 1153
  • 1154
  • 1155
  • 1156
  • 1157
  • 1158
  • 1159
  • 1160
  • 1161
  • 1162
  • 1163
  • 1164
  • 1165
  • 1166
  • 1167
  • 1168
  • 1169
  • 1170
  • 1171
  • 1172
  • 1173
  • 1174
  • 1175
  • 1176
  • 1177
  • 1178
  • 1179
  • 1180
  • 1181
  • 1182
  • 1183
  • 1184
  • 1185
  • 1186
  • 1187
  • 1188
  • 1189
  • 1190
  • 1191
  • 1192
  • 1193
  • 1194
  • 1195
  • 1196
  • 1197
  • 1198
  • 1199
  • 1200
  • 1201
  • 1202
  • 1203
  • 1204
  • 1205
  • 1206
  • 1207
  • 1208
  • 1209
  • 1210
  • 1211
  • 1212
  • 1213
  • 1214
  • 1215
  • 1216
  • 1217
  • 1218
  • 1219
  • 1220
  • 1221
  • 1222
  • 1223
  • 1224
  • 1225
<script>
/*
 * ITA/DEU
 */
var pricepoint = RSI({cat: 'eng', lvl: 'S5', media: 'box'})[0].price

if (!pricepoint.match(/169|179|199|249/)) {
  // todo maybe redirect to 169?
}


var data = {
  fra: {
    '3 Month': {
      sku: 90487,
      msrp: 79.00,
      promos: {
        249: {code: '', price: 79.00},
        199: {code: 'manila_3M', price: 69.00},
        179: {code: 'anchorage_3M', price: 59.00},
        169: {code: 'auckland_3M', price: 59.00}
      }
    },
    '6 Month': {
      sku: 97352,
      msrp: 119.00,
      promos: {
        249: {code: '', price: 119.00},
        199: {code: 'manila_6M', price: 89.00},
        179: {code: 'anchorage_6M', price: 99.00},
        169: {code: 'auckland_6M', price: 79.00}
      }
    },
    '12 Month': {
      sku: 97342,
      msrp: 179.00,
      promos: {
        249: {code: '', price: 179.00},
        199: {code: 'manila_12M', price: 149.00},
        179: {code: 'anchorage_12M', price: 129.00},
        169: {code: 'auckland_12M', price: 119.00}
      }
    },
    lifetime: {
      sku: 99053,
      msrp: 249.00,
      promos: {
        249: {code: '', price: 249.00},
        199: {code: 'manila_life', price: 199.00},
        179: {code: 'anchorage_life', price: 179.00},
        169: {code: 'auckland_life', price: 169.00}
      }
    }
  },
  eng: {
    online: {
      '1 Month': {
        sku: 90472,
        msrp: '19.95',
        promos: {
          249: {code: '', price: '19.95'},
          199: {code: '', price: '19.95'},
          179: {code: '', price: '19.95'},
          169: {code: '', price: '19.95'}
        }
      },
      '12 Months': {
        sku: 97342,
        msrp: '179.00',
        promos: {
          249: {code: '', price: '179.00'},
          199: {code: 'tremblant_12M', price: '149.00'},
          179: {code: 'kiev_12M', price: '129.00'},
          169: {code: 'hamburg_12M', price: '119.00'}
        }
      },
      Lifetime: {
        sku: 99053,
        msrp: '249.00',
        promos: {
          249: {code: '', price: '249.00'},
          199: {code: 'tremblant_Life', price: '199.00'},
          179: {code: 'kiev_Life', price: '179.00'},
          169: {code: 'hamburg_Life', price: '169.00'}
        }
      }
    },
    download: {
      'Level 1': {
        sku: 24360,
        msrp: '124.00',
        promos: {
          249: {code: '', price: '124.00'},
          199: {code: 'tremblant_L1DL', price: '99.00'},
          179: {code: 'kiev_L1DL', price: '89.00'},
          169: {code: 'hamburg_L1DL', price: '84.00'}
        },
        backup: {
          sku: 52313,
          promos: {
            249: {code: '', price: '25.00'},
            199: {code: 'tremblant_L1CDB', price: '25.00'},
            179: {code: 'kiev_L1CDB', price: '25.00'},
            169: {code: 'hamburg_L1CDB', price: '25.00'}
          }
        }
      },
      'Levels 1-3': {
        sku: 24361,
        msrp: '199.00',
        promos: {
          249: {code: '', price: '199.00'},
          199: {code: 'tremblant_S3DL', price: '159.00'},
          179: {code: 'kiev_S3DL', price: '144.00'},
          169: {code: 'hamburg_S3DL', price: '134.00'}
        },
        backup: {
          sku: 52315,
          promos: {
            249: {code: '', price: '25.00'},
            199: {code: 'tremblant_S3CDB', price: '25.00'},
            179: {code: 'kiev_S3CDB', price: '25.00'},
            169: {code: 'hamburg_S3CDB', price: '25.00'}
          }
        }
      },
      'Levels 1-5': {
        sku: 24362,
        msrp: '249.00',
        promos: {
          249: {code: '', price: '249.00'},
          199: {code: 'tremblant_S5DL', price: '199.00'},
          179: {code: 'kiev_S5DL', price: '179.00'},
          169: {code: 'hamburg_S5DL', price: '169.00'}
        },
        backup: {
          sku: 52317,
          promos: {
            249: {code: '', price: '25.00'},
            199: {code: 'tremblant_S5CDB', price: '25.00'},
            179: {code: 'kiev_S5CDB', price: '25.00'},
            169: {code: 'hamburg_S5CDB', price: '25.00'}
          }
        }
      }
    }
  }
}


/*
 *  Toggles control product area on/off
 */

function toggleControl(flag) {
  if (flag == 'off') {
    // hide mobile control
    $('#products-mobile > .container > *:not(.select-holder):not(#portfolio-mobile-wrap-eng)').hide()
    $('#products-mobile').find('.desktop .content > *').hide()

     // hide desktop control
    $('#prod-options > form').hide()

  } else {
    $('#products').css({background: '#f8f8f8'})

    $('#products-mobile > .container > *:not(.select-holder):not(#portfolio-mobile-wrap-eng)').show()
    $('#products-mobile').find('.desktop .content > *').show()

    // Show desktop control
    $('#prod-options > form').show()

    $('a#compareButton').show()

    // hide english layout
    $desktop_eng.hide()
    $desktop_fra.hide()
    $mobile_eng.hide()
    //$mobile_fra.hide()
  }
}

/*
 * Handles English
 * product area for desktop
 */

function handleEngDesktop() {
  toggleControl('off')
  $desktop_fra.hide()
  $desktop_eng.show()

  //var langname = RSI({cat:selectedLang,media:'download'})[0];
  var $form_online = $('form.portfolio-poducts-desktop-online')
  var $form_download = $('form.portfolio-poducts-desktop-download')

  $form_online.find('.labels').empty()
  $form_download.find('.labels').empty()

  var rendered_form_online = renderEngForm('online')
  var rendered_form_download = renderEngForm('download')
  $form_online.find('.labels').prepend(rendered_form_online)
  $form_download.find('.labels').prepend(rendered_form_download)

  $('a#compareButton').hide()

}

/*
 * Handles English
 * product area for mobile
 */

function handleEngMobile() {
  toggleControl('off')

  $('#products').css({background: '#f8f8f8'})

  $desktop_fra.hide()
  $mobile_eng.show()


  //var langname = RSI({cat:selectedLang,media:'download'})[0];
  //var compiled_template_online = ''
  //var compiled_template_download = ''

  $form_online = $('form.portfolio-poducts-desktop-online')
  $form_download = $('form.portfolio-poducts-desktop-download')

  $form_online.find('.labels').empty()
  $form_download.find('.labels').empty()

  // **** COMPILE FORM FOR ONLINE
  var rendered_form_online = renderEngForm('online')
  var rendered_form_download = renderEngForm('download')

  $form_online.find('.labels').prepend(rendered_form_online)
  $form_download.find('.labels').prepend(rendered_form_download)

  // When page loads, we update big sale price with sale price of checked input
  var initialprice_online = $('#portfolio-mobile-wrap-eng form:eq(0) input[type=radio]:checked')
    .parent()
    .siblings('.portfolio-saleprice')
    .children('span')
    .html()
  $('#portfolio-mobile-wrap-eng form:eq(0) > .portfolio-saleprice').html(initialprice_online)
  var initialprice_download = $('#portfolio-mobile-wrap-eng form:eq(1) input[type=radio]:checked')
    .parent()
    .siblings('.portfolio-saleprice')
    .children('span')
    .html()
  $('#portfolio-mobile-wrap-eng form:eq(1) > .portfolio-saleprice').html(initialprice_download)
}


/*
 * Handles French, Italian, German
 * product area for desktop AND mobile.
 */

function handleFra() {
  toggleControl('off')
  $desktop_eng.hide()
  $mobile_eng.hide()
  $desktop_fra.css({display:'table'})
  $('a#compareButton').hide()
  $('#products').css({background: '#fff'})


  $desktop_fra.empty().html(renderFraForm())



  //$('#dropdown-language + .portfolio-desktop-wrap-fra').remove()
  //$('#dropdown-language').after($desktop_fra.clone(true))

}

/*
 * Handles French, Italian, German
 * product area for mobile
 */

/*function handleFraMobile() {
  toggleControl('off')
  $mobile_eng.hide()
}*/




// TnT adds the divs to bottom of page. Put them where we need them
$desktop_eng = $('#portfolio-desktop-wrap-eng').detach()
$('#prod-options').append($desktop_eng)

$mobile_eng = $('#portfolio-mobile-wrap-eng').detach()
$('#products-mobile').append($mobile_eng)

$desktop_fra = $('.portfolio-desktop-wrap-fra').detach()
$('#prod-options').after($desktop_fra)

$('#products-mobile').after($desktop_fra)

//$mobile_fra = $('#portfolio-mobile-wrap-fra').detach()
//


/*
 * DESKTOP LANG CLICK - overwrite control's
 * Test module only handles FIGS. We still let the original click
 * handler do its other jobs, but if language is FIGS, we
 * add on to the handler (by adding another handler =/ )
 */

$('.language-buy-list li a').click(function() {

  selectedLang = $(this).attr('id')

  var $desktop;

 if (selectedLang.match(/ita|deu/i)) {

    handleFra()
  } else {
    // show control module
    toggleControl('on')

  }
})



// ********** ADDING TO CART - ENG DESKTOP AND MOBILE
$('a.portfolio-addtocart-eng').click(function(e) {
  e.preventDefault()

  if ($(this).hasClass('portfolio-mobile-addtocart')) {
    // add to cart was clicked in mobile
    var $form = $('#portfolio-mobile-wrap-eng .tabs-content > div:visible form')
  } else {
    // add to cart was clicked in desktop
    var $form = $(this).parents('form')

  }



  // grab sku of select
  var sku = $form.find('input[type=radio]:checked').data('sku')

  // grab promocode
  var promo = $form.find('input[type=radio]:checked').data('promo')

  // Key so we can get cd backup if needed
  var key = $form.find('input[type=radio]:checked').data('key')

  // Update sku and promo if cd backup is checked
  var related_sku = null
  if ($form.hasClass('portfolio-poducts-desktop-download') && $form.find('input[name=backupcd]').is(':checked')) {

    related_sku = data.eng.download[key].backup.sku
    promo = data.eng.download[key].backup.promos[pricepoint].code

  }


  // http://secure.stg.rosettastone.com/us_en_store_view/checkout/cart/add/sku/24362/category_id/ENG/related_sku/52317

  // But Back up cd has promocode too, pass two promocodes? or do we overwrite other promo?

  carturl = 'https://secure.rosettastone.com/us_en_store_view/checkout/cart/add/sku/' + sku + '/category_id/' + selectedLang
  carturl += related_sku ? '/related_sku/' + related_sku + '/' : ''
  carturl += '?pc=' + promo
  carturl += $form.find('input[name=gift]').is(':checked') ? '&gifting=1' : ''
  window.location.href = carturl

})


// ********** ADDING TO CART - ENG MOBILE
/*$('.portfolio-mobile-addtocart').click(function(e) {
  e.preventDefault()
  var sku = $form.find('input[type=radio]:checked').data('sku')
})
*/


/*
 * MOBILE LANG CLICK - overwrite control's
 *
 */

$('select#dropdown-language').change(function() {
  if (selectedLang.match(/ita|deu/i)) {
    handleFra()
  } else {
    // Show control
    toggleControl('on')
  }
});






/*
 * Handle mobile form click - we basically update the big price
 * under the radio buttons
 */

$('#portfolio-mobile-wrap-eng form').on('change', 'input[type=radio]', function() {
  var saleprice = $(this).parents('label').find('.portfolio-saleprice span').html()
  $(this).parents('form').children('.portfolio-saleprice').html(saleprice)
})



/*
 * Show right products when clicking tabs in mobile
 */
var $tabscontent = $('.tabs-content')
$('.tabs > a').click(function(e, i) {
  e.preventDefault()
  $(this).parent().find('.active').removeClass('active')
  $(this).addClass('active')
  var index = $(this).index()
  $tabscontent.children('div').hide()
  $tabscontent.children('div').eq(index).show()
})

/*
 * Renders product form for English.
 * @param {str}  type - 'online' or 'download'
 */
function renderEngForm(type) {
  var compiled = ''
  Object.keys(data.eng[type]).forEach(function(key,i) {
    var obj = data.eng[type][key]
    var sku = obj.sku
    var msrp = obj.msrp
    var promo = obj.promos[pricepoint].code
    var price = obj.promos[pricepoint].price
    var checked = i == 0 ? 'checked' : ''

    compiled += '<label>'
    + '<div class="fakeinput">'
    + '<input type="radio" name="length" '+ checked +' data-sku="'+ sku +'" data-promo="'+ promo +'" data-key="'+key+'">'
    + '<span></span>'
    + '</div>'
    + '<div class="durationcopy">'+ key +'</div>'
    + '<div class="portfolio-msrpprice"';
    if (msrp == price) compiled += 'style="display:none" '
    compiled += '><span>$'+ msrp +'</span></div>'
    + '<div class="portfolio-saleprice"><span>$'+ price +'</span></div>'
    + '</label>'
  })
  return compiled
}


/*
 * Renders product form for Fra/Deu/Ita.
 */
function renderFraForm() {
  var compiled = ''
  Object.keys(data.fra).forEach(function(key,i) {
    var obj = data.fra[key]
    var sku = obj.sku
    var msrp = obj.msrp
    var promo = obj.promos[pricepoint].code
    var price = obj.promos[pricepoint].price
    switch (i) {
      case 0:
        var charge_amount = price / 3
        var terms = '$' + price + ' due today'
        break;
      case 1:
        var charge_amount = price / 6
        var terms = '$' + price + ' due today'
        break;
      case 2:
        var charge_amount = price / 12
        var terms = '$' + price + ' due today'
        break;
      case 3:
        var charge_amount = price
        var terms = 'one time payment'
        break;
    }
     var carturl = 'https://secure.rosettastone.com/us_en_store_view/checkout/cart/add/sku/'
     carturl += sku + '/category_id/' + selectedLang + '/?pc='+promo
    compiled += '<div>'
    + '<h4>' + key + '</h4>'
    + '<div>Access</div>'
    + '<div>'
    + '<div class="pricing">'
    //+ '<div class="msrpprice"><span>$' + msrp + '</span></div>'
    + '<div class="saleprice">'
    + '<span>$</span>'
    + '<span>' + Math.ceil(charge_amount)  + '</span>'
    + '<span>/month</span>'
    + '</div>'
    + '<a href="'+ carturl +'" class="portfolio-addtocart-fra">ADD TO CART</a>'
    + '</div>'
    + '</div>'
    + '<p>' + terms + '</p>'
    + '</div>'
  })
  return compiled
}




if (grabUrlParam('language')) {
  $('#' + grabUrlParam('language')).click()
}







</script>







<style>
/********************* DESKTOP ENG *********************/
#portfolio-desktop-wrap-eng {

  display: none;
  /*display: table;*/
  margin: 0 auto;
  width:  90%;
  font-size: 90%;
}
#portfolio-desktop-wrap-eng form label .durationcopy {
  width: 40%;
}

#portfolio-desktop-wrap-eng form label .saleprice {
  text-align:  right;
}

#portfolio-desktop-wrap-eng {

}

#portfolio-desktop-wrap-eng > div:not(.spacer) {
  text-align: center;
  display: table-cell;
  padding: 20px;
  margin: 0 auto;
  width: 40%;
  border-radius: 5px;
  border: 1px solid #eee;
}

#portfolio-desktop-wrap-eng > .portfolio-online,
  #portfolio-desktop-wrap-eng > .portfolio-download {
  background: white;
}


.spacer {
  display: table-cell;
  width: 5%;
}


#portfolio-desktop-wrap-eng h3 {
  text-align:  center;
  color: white;
  padding: 15px;
  background: #0098db;
}
#portfolio-desktop-wrap-eng .portfolio-download h3 { background: #ecc200}

#portfolio-desktop-wrap-eng .prodimg {
  margin: 20px auto 0px;
}

#portfolio-desktop-wrap-eng p {
  font-size: 95%;
  color: #999;
  margin: 15px 0;
}

#portfolio-desktop-wrap-eng ul,
#portfolio-desktop-wrap-eng form {
  text-align: left;
}

#portfolio-desktop-wrap-eng ul li {
  list-style: none;
  padding-left: 25px;
  background: url(http://www.rosettastone.com/lp/catalog2015/spo2/check.png) left 5px no-repeat;
  background-size: 5%;
  margin-bottom: 10px;
  font-size: 90%;
}

/* FORMS */
.portfolio-wrap-eng form label { display: table; width: 88%; margin: 0 auto; }
.portfolio-wrap-eng form label > * {
  display: table-cell;
  vertical-align: top;
}
.portfolio-wrap-eng form .labels label > :nth-child(2) {
  width: 40%;
}
.portfolio-wrap-eng form .labels label > :nth-child(3) {
  color: red;
  text-decoration: line-through;
  float: left;
}
.portfolio-wrap-eng form .labels label > :nth-child(3) > span {
  color: #909090;
}
.portfolio-wrap-eng form .labels label > :nth-child(4) {
  text-align: right;
}

.portfolio-wrap-eng form label .fakeinput {
  width: 11%;
}
.portfolio-wrap-eng form label .fakeinput input {
  position: absolute;
  left: -19999px;
}
.portfolio-wrap-eng form label .fakeinput input + span {
  background: white;
  border: 1px solid #999;;
  border-radius: 20px;
  width: 9px;
  height: 9px;
  display: block;
  margin: 4px 0 0 8px;
}
.portfolio-wrap-eng form label .fakeinput input:checked + span {
  background: white;
  border: 4px solid #0098db;
  width: 3px;
  height: 3px;
  position: relative;
}

.cartwrap {
  text-align: center;
  margin: 20px 0;
}

a.portfoliocart {
  background: #0098db;
  padding: 10px 0;
  width: 50%;
  color: #fff;
  display: inline-block;
  text-decoration: none;
  text-align: center;
  border-radius: 3px;
}

/* to align with addtocart on subscription column */
.portfolio-poducts-desktop-download .cartwrap {
  margin-top: 57px;
}

.backup {
  margin: 15px auto;
  width: 70%;
}
.backup > label {

  border: 1px solid #ccc;
  padding: 5px;
}
.backup > label > * {
  display: inline-block;
}
.backup > label > input {
  position: relative;
  bottom: -1px;
  right: -1px;
}

.backup > label > *:first-child {
  position: relative;
  bottom: -1px;
  width: 9%;
}

.backup > label > *:last-child {
  position: relative;
  float: right;
}
.portfolio-wrap-eng form div.gift label { text-align: center;

}
.portfolio-wrap-eng form div.gift label > *, .portfolio-wrap-eng form div.gift label > input {
  display:  inline-block;
}

.portfolio-wrap-eng form div.gift label > span {
  position: relative;
  top: -2px;
  right: -3px;
}
.portfolio-wrap-eng form div.gift label > img {
  width: 15px;
  position: relative;
  left: -2px;
  top: 0px;
}





/********************* MOBILE ENG *********************/

#portfolio-mobile-wrap-eng {
  display: none;
  padding: 0 15px;
  box-sizing: border-box;
}

#portfolio-mobile-wrap-eng > .content > h3 {
  font-size: 1.4em;
  text-align: center;
  font-weight: lighter;
}
#portfolio-mobile-wrap-eng > .content > .tabs {
  display: table;
  width: 100%;

}
#portfolio-mobile-wrap-eng > .content > .tabs a {
  display: table-cell;
  width: 50%;
  text-align: center;
  background: #d1d4d3;
  text-decoration: none;
  padding: 15px 0;
  color: #444;
}

#portfolio-mobile-wrap-eng > .content > .tabs > a.subscription.active {
  background: #0098db;
  color: #fff;
}

#portfolio-mobile-wrap-eng > .content > .tabs > a.download.active {
  background: #ecc200;
}

#portfolio-mobile-wrap-eng > .content > .tabs-content {
  background: #fff;
  padding: 15px;
}

#portfolio-mobile-wrap-eng > .content > .tabs-content p {
  text-align: center;
  color: #999;
}

#portfolio-mobile-wrap-eng > .content > .tabs-content > div.tabcontent-download {
  display: none;
}

#portfolio-mobile-wrap-eng > .content > .tabs-content ul {
  padding: 20px 0 5px 0;
}
#portfolio-mobile-wrap-eng > .content > .tabs-content ul li {
  list-style: none;
  padding-left: 25px;
  background: url(http://www.rosettastone.com/lp/catalog2015/spo2/check.png) left 5px no-repeat;
  background-size: 5%;
  margin-bottom: 10px;
  font-size: 90%;
}

#portfolio-mobile-wrap-eng.portfolio-wrap-eng form .labels  {
  border-top: 1px solid #ccc;
  border-bottom: 1px solid #ccc;
  padding: 15px 0;
  margin: 15px 0 5px 0;
}

#portfolio-mobile-wrap-eng.portfolio-wrap-eng form label {width: 100%}
/*#portfolio-mobile-wrap-eng.portfolio-wrap-eng form label > * { vertical-align: top}*/

#portfolio-mobile-wrap-eng.portfolio-wrap-eng form .labels label {
  padding: 5px 0;
}

#portfolio-mobile-wrap-eng.portfolio-wrap-eng form label > :nth-child(1) {
  width: 8%;
  position: relative;
  bottom: -2px;
}

#portfolio-mobile-wrap-eng.portfolio-wrap-eng form label > :nth-child(2) {
  width: 50%;
}

#portfolio-mobile-wrap-eng.portfolio-wrap-eng form .labels label > :nth-child(3) {
  color: red;
  text-decoration: line-through;
  float: right;
  vertical-align: middle;

}
#portfolio-mobile-wrap-eng.portfolio-wrap-eng form label > :nth-child(3) > span {
  color: #909090;
}

#portfolio-mobile-wrap-eng.portfolio-wrap-eng form label > :nth-child(4) {
  text-align: right;

}

.portfolio-saleprice {
  font-weight: bold;
  font-size: 120%;
}

.portfolio-msrpprice {
  color: #909090;
  position: relative;

  bottom: -3px;

}

.portfolio-msrpprice:before {
  content: '';
  width: 100%;
  height: 0px;
  background: red;
  position: absolute;
  top: 48%;
}

#portfolio-mobile-wrap-eng  form > .portfolio-saleprice {
  font-size: 2.4em;
  text-align: center;
  font-weight: lighter;
}

#portfolio-mobile-wrap-eng  form .gift label {
  display: block;
  padding-top: 10px;
  color: #999;
  width: 80%;

}

#portfolio-mobile-wrap-eng  form .gift label > * {
  display: inline-block;
  vertical-align: top;
}
#portfolio-mobile-wrap-eng  form .gift label > :nth-child(1) {
  top: -2px;
}
#portfolio-mobile-wrap-eng  form .gift label > img {
  padding: 0;
}

#portfolio-mobile-wrap-eng.portfolio-wrap-eng form .backup label  {

  display: table;
  width: 70%;
  border: 1p xsolid #ccc;
  padding: 5px;
  box-sizing: border-box;
}

#portfolio-mobile-wrap-eng.portfolio-wrap-eng form .backup label > * {
  display: table-cell;

  padding: 0;
}
#portfolio-mobile-wrap-eng.portfolio-wrap-eng form .backup label > :nth-child(1) {
  width: 12%;
}
#portfolio-mobile-wrap-eng.portfolio-wrap-eng form .backup label > :nth-child(2) {
  bottom: -1px;
  position: relative;
}
#portfolio-mobile-wrap-eng.portfolio-wrap-eng form .backup label > :nth-child(3) {
  right: auto;
  float: right;
}


#portfolio-mobile-wrap-eng a.portfolio-mobile-addtocart {
  background: #ecc200;
  margin: 15px auto 0;
  display: block;
  padding: 10px 0;
  font-weight: bold;
  text-decoration: none;
  color: #444;
  border-radius: 3px;
  text-align: center;

}















/********************* DESKTOP FRA *********************/
.portfolio-desktop-wrap-fra {
  display: table;
  background: #fff;
  width: 90%;
  margin: 0 auto;
  border-spacing: 15px;
  display: none;
}

.portfolio-desktop-wrap-fra > div {
  border: 7px solid #EFEDE0;
  background: #F7F6F1;
  display: table-cell;
  text-align: center;
  width: 23%;
  padding: 15px;
  box-sizing: border-box;
  /*margin-right: 3%;*/
}

.portfolio-desktop-wrap-fra > div:last-child {
  margin: 0;
  border: 7px solid #ECC100;
  background: #fff;
  box-shadow: 0 0 10px rgba(0,0,0,0.25)
}

.portfolio-desktop-wrap-fra > div h4 {
  letter-spacing: 1px;
  color: #262626;
}
.portfolio-desktop-wrap-fra > div h4 + div {
  font-size: 90%;
  color: #444;
  letter-spacing: 1px;
}


.portfolio-desktop-wrap-fra .pricing {
  border-top: 2px solid #EFEDE0;
  padding-top: 10px;
  margin-top: 10px;
  width: 90%;
  color: #262626;
  margin: 0 auto;
}
.portfolio-desktop-wrap-fra .pricing .msrpprice {
  color: red;
  text-decoration: line-through;
}

.portfolio-desktop-wrap-fra .pricing .msrpprice span {
  color: #999;
}



.portfolio-desktop-wrap-fra .pricing .saleprice { display: table; width: auto;  border-spacing: 0; margin: 0 auto;}
.portfolio-desktop-wrap-fra .pricing .saleprice > span {
  display:  table-cell;
  position: relative;
}

/* $ sign */
.portfolio-desktop-wrap-fra .pricing .saleprice > span:nth-of-type(1) {
  top: -13px;
  text-align: right;
}

/*  sale price */
.portfolio-desktop-wrap-fra .pricing .saleprice > span:nth-of-type(2) {
  font-size: 2.2em;
  font-weight: bold;
  padding: 0 3px 0 3px;
}

/* /mo */
.portfolio-desktop-wrap-fra .pricing .saleprice > span:nth-of-type(3) {
  text-align: left;
  font-size: 90%;
}

.portfolio-desktop-wrap-fra a {
  background: #189AD8;
  text-decoration: none;
  text-align: center;
  display: inline-block;
  width: 90%;
  margin: 3px auto 10px;
  padding: 7px 0;
  color: #fff;
  font-size: 80%;
  border-radius: 3px;
}
.portfolio-desktop-wrap-fra p {
  font-size: 80%;
}

/* tablets */
@media  only  screen and (max-width: 1025px) {
  .portfolio-desktop-wrap-fra > div {
    display: inline-block;
    width: 46%;
    margin: 0 20px 20px 0;
  }
  .portfolio-desktop-wrap-fra > div:nth-of-type(3) {

  }
}
/*  any device smaller than 720px, show stacked  */
@media only screen and (max-width: 720px) {
  .portfolio-desktop-wrap-fra > div {
    display: block;
    margin-bottom: 10px;
    width: 100%;
  }
}

</style>







<!-- BEGIN PORTFOLIO MOBILE ENG -->
<div id="portfolio-mobile-wrap-eng" class="portfolio-wrap-eng">
  <div class="content">
    <h3>Select a Product</h3>
    <div class="tabs">
      <a href="#" class="subscription active">SUBSCRIPTION</a>
      <a href="#" class="download ">DOWNLOAD</a>
    </div>

    <div class="tabs-content">
      <div class="tabcontent-subscription">
        <img src="../assets/online.png" class="prodimg" alt="">
        <p>Get <b>total access</b> on your phone, tablet, and desktop computer</p>
        <ul>
          <li>Unlimited access for selected duration</li>
          <li>Access for 1 person</li>
          <li>Learn anywhere on any device, including use of our award-winning mobile app</li>
          <li>Speech Recognition</li>
        </ul>
        <form action="" class="portfolio-poducts-desktop-online">
          <div class="labels"></div>
          <div class="portfolio-saleprice"></div>
          <div class="gift">
            <label>
              <img src="http://www.rosettastone.com/lp/catalogpages/img/gifting.png" alt="" class="icon-gift" />
              <div>
                <input type="checkbox" name="gift" />
                <span>Give as a gift!</span>
              </div>
            </label>
          </div>
        </form>
      </div> <!-- end subscription content -->

      <div class="tabcontent-download">
        <img src="../assets/download.png" class="prodimg" alt="">
        <p>Download our software for <b>easy access anytime</b></p>
        <ul>
          <li>Learn at your own pace with our course that never expires</li>
          <li>Access for up to 5 family members</li>
          <li>Speech Recognition</li>
        </ul>

        <form action="" class="portfolio-poducts-desktop-download">
          <div class="labels"></div>
          <div class="portfolio-saleprice"></div>
          <div class="mobile-backup backup">
            <label>
              <div><input type="checkbox" name="backupcd"></div>
              <span>CD Backup</span>
              <span>+ $25.00</span>
            </label>
          </div>
          <div class="gift">
            <label>
              <img src="http://www.rosettastone.com/lp/catalogpages/img/gifting.png" alt="" class="icon-gift" />
              <div>
                <input type="checkbox" name="gift" />
                <span>Give as a gift!</span>
              </div>
            </label>
          </div>
        </form>
      </div> <!-- end subscription content -->
    </div>
  </div>
  <a class="portfolio-mobile-addtocart portfolio-addtocart-eng"  href='#'>ADD TO CART</a>
  <img src="../assets/100.png" alt="100 percent guarantee">
</div>
<!-- END PORTFOLIO MOBILE ENG -->

<!-- BEGIN PORTFOLIO DESKTOP ENG -->
<div id="portfolio-desktop-wrap-eng" class="portfolio-wrap-eng">
  <div class="portfolio-online">
    <div>
      <h3>SUBSCRIPTION WITH APP</h3>
      <img src="../assets/online.png" class="prodimg" alt="">
      <p>Get <b>total access</b> on your phone, tablet, and desktop computer</p>

      <ul>
        <li>Unlimited access for selected duration</li>
        <li>Access for 1 person</li>
        <li>Learn anywhere on any device, including use of our award-winning mobile app</li>
        <li>Speech Recognition</li>
      </ul>

      <form action="" class="portfolio-poducts-desktop-online">
        <div class="labels"></div>

        <div class="cartwrap">
          <a href="" class="portfoliocart portfolio-addtocart-eng">ADD TO CART</a>
        </div>

        <div class="gift">
          <label>
            <img src="http://www.rosettastone.com/lp/catalogpages/img/gifting.png" alt="" class="icon-gift" />
            <input type="checkbox" name="gift" />
            <span>Give as a gift!</span>
          </label>
        </div>

      </form>
    </div>
  </div>

    <div class="spacer"></div>

  <div class="portfolio-download">
    <div>
      <h3>INSTANT DOWNLOAD</h3>
      <img src="../assets/download.png" class="prodimg" alt="">
      <p>Own our desktop course <b>forever</b> with Instant Download</p>

      <ul>
        <li>Learn at your own pace with our course that never expires</li>
        <li>Access for up to 5 family members</li>
        <li>Speech Recognition</li>
      </ul>

      <form action="" class="portfolio-poducts-desktop-download">
        <div class="labels"></div>
        <div class="cartwrap">
          <a href="" class="portfoliocart portfolio-addtocart-eng">ADD TO CART</a>
        </div>
        <div class="backup">
          <label>
            <div><input type="checkbox" name="backupcd"></div>
            <span>CD Backup</span>
            <span>+ $25.00</span>
          </label>
        </div>
        <div class="gift">
          <label>
            <img src="http://www.rosettastone.com/lp/catalogpages/img/gifting.png" alt="" class="icon-gift" />
            <input type="checkbox" name="gift" />
            <span>Give as a gift!</span>
          </label>
        </div>

      </form>
    </div>
  </div>
</div> <!-- /end portfolio desktop wrap -->
<!-- END PORTFOLIO DESKTOP ENG -->


<!-- BEGIN PORTFOLIO DESKTOP FRA -->
<div class="portfolio-desktop-wrap-fra">
  <div>
    <h4>3 MONTH</h4>
    <div>Access</div>
    <div>
      <div class="pricing">
        <div class="msrpprice"><span>199</span></div>
        <div class="saleprice">
          <span>$</span>
          <span>26</span>
          <span>/month</span>
        </div>
        <a href='#' class="portfolio-addtocart-fra">ADD TO CART</a>
      </div>
    </div>
    <p>$79 charged every 3 months</p>
  </div>
</div><!-- END PORTFOLIO DESKTOP FRA -->