Mon Nov 14 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
// multivariate mobile sbsr test nov 2016

$(function(){


	// content to insert
	var content = '<!-- begin multivariate test html --> <style> /********************************* UTILITIES **********************************/ .zerofont{ font-size: 0px; } .hide_for_test{ display: none; } .show_for_test{ display: block; } /********************************* TEST CONTAINER STYLES **********************************/ .nov_2016_mvt_mobile{ text-align: center; font-family: gothambook; } .nov_2016_product_info_container{ background: #F8F6F0; padding: 20px 15px; } .js_nov_2016_cddl{ display: none; } /********************************* ONLINE + CD/DL BUTTONS **********************************/ .nov_2016_online_cddl_container{ padding: 0px 0px 20px; } .nov_2016_online_cddl_buttons{ border: 3px solid #333; border-radius: 3px; max-width: 400px; margin: auto; } .nov_2016_online_cddl_container label{ font-size: 14px; display: inline-block; padding: 16px 0px; text-transform: uppercase; cursor: pointer; font-family: gothambold; width: 50%; } .nov_2016_online_cddl{ display: none; } .nov_2016_online_cddl:checked + label{ background: #333; color: #fff; } /********************************* REVIEW STARS **********************************/ .nov_2016_review_star_container{ margin: 10px 0px; } .hollow_stars{ position: relative; display: inline-block; vertical-align: middle; font-size: 16px; } .filled_stars{ position: absolute; left: 0px; top: 0px; overflow: hidden; white-space: nowrap; width: 91.5%; } .nov_2016_review_star_text{ font-size: 14px; display: inline-block; vertical-align: bottom; } /********************************* PRODUCT INFO **********************************/ .nov_2016_prod_img{ max-width: 90%; } .nov_2016_language_header{ color: #0098db; font-size: 24px; margin-top: 10px; } .nov_2016_language_subhead{ font-size: 24px; } .nov_2016_product_intro{ line-height: 1.3; text-align: left; font-size: 15px; } .nov_2016_ul{ text-align: left; margin: 20px 0px 0px; padding: 0px 0px 0px 40px; list-style-type: none; } .nov_2016_ul li{ position: relative; margin-bottom: 20px; font-size: 15px; font-family: gothambold; } .nov_2016_ul li:before{ content: \'\'; position: absolute; left: -30px; top: 0px; display: inline-block; border: 2px solid #0098db; border-top: none; border-right: none; height: 10px; width: 20px; transform: rotate(-45deg); } /********************************* PRODUCT RADIOS **********************************/ .nov_2016_purchase_section{ background: #fff; color: #333; padding: 10px 20px; } .nov_2016_select_title{ font-size: 24px; margin: 20px auto 10px; max-width: 250px; } .nov_2016_product_radios{ text-align: left; } .nov_2016_product_radios label{ display: block; margin: 15px 0px; font-size: 14px; } .nov_2016_radio_prices{ float: right; } .nov_2016_radio_msrp{ color: #a00; position: relative; font-size: 10px; vertical-align: middle; display: inline-block; } .nov_2016_radio_msrp:after{ content: \'\'; position: absolute; top: 50%; left: -5%; width: 110%; border-top: 1px solid #a00; } .nov_2016_radio_price{ color: #0098db; vertical-align: middle; display: inline-block; } /********************************* CD/DL RADIOS **********************************/ .nov_2016_cddl_radios{ border-bottom: 1px solid #ddd; } /********************************* PRODUCT OPTIONS - SQUARE **********************************/ .nov_2016_product_square{ border: 1px solid #EBEAE6; border-radius: 3px; background-color: #0098db; background-image: radial-gradient(#0088cb 83%,#0098db); margin: 9px auto; color: #333; max-width: 350px; vertical-align: top; } .nov_2016_product_square_content{ display: block; background-color: #f8f6f0; border-top-left-radius: 110px 30px; padding: 24px 0px 16px; } .nov_2016_product_square_header{ text-transform: uppercase; font-family: gothambold; font-size: 14px; } /********************************* PRICES - SQUARE **********************************/ .nov_2016_price_container_square{ vertical-align: middle; margin: 5px 0px 2px; } .nov_2016_price_container_square_cddl{ /*margin-bottom: 0px;*/ } .nov_2016_big_price_square{ font-size: 43px; vertical-align: baseline; color: #0078bb; font-family: gothambold; } .nov_2016_big_price_square:before{ content: \'$\'; font-size: 50%; vertical-align: top; position: relative; top: 5px; } .nov_2016_big_price_square:after{ content: \' / Month\'; font-size: 14px; vertical-align: baseline; position: relative; top: -2px; font-family: gothambook; color: #333; } .nov_2016_big_price_square.no_month:after{ display: none; } /********************************* GIFTING - SQUARE **********************************/ .nov_2016_gifting_square, .nov_2016_gifting_square *{ vertical-align: middle; } .nov_2016_gifting_square{ font-size: 12px; margin-right: 18px; display: inline-block; background-image: url(\'http://www.rosettastone.com/lp/spo/mobile_sbsr_nov_2016/assets/gift.svg\'); background-repeat: no-repeat; background-position: left 50%; background-size: 12px; padding-left: 16px; } /********************************* MULTIPAY and MSRP - SQUARE **********************************/ .nov_2016_multipay_strikeprice_square{ color: #d00; position: relative; } .nov_2016_multipay_strikeprice_square:after{ content: \'\'; position: absolute; width: 110%; left: -5%; top: 50%; border-top: 1px solid #d00; } .nov_2016_msrp_square{ font-size: 13px; margin-bottom: 10px; } /********************************* CART - SQUARE **********************************/ .nov_2016_addtocart_square{ vertical-align: middle; background: #0098db; color: #fff; border-radius: 3px; padding: 16px; text-transform: uppercase; text-decoration: none; font-size: 16px; font-family: gothambold; display: block; } .nov_2016_addtocart_square:hover{ background: #1ae; color: #fff; text-decoration: none; } /********************************* GUARANTEE **********************************/ .nov_2016_guarantee_vertical{ background-image: url(\'http://www.rosettastone.com/lp/spo/mobile_sbsr_nov_2016/assets/guarantee.png\'); background-repeat: no-repeat; background-position: center top; padding-top: 90px; margin-top: 20px; } .nov_2016_guarantee_line1{ font-size: 18px; text-transform: uppercase; color: #0088cb; font-family: gothambold; } .nov_2016_guarantee_line2{ font-size: 14px; } </style> <!-- begin multivariate test html --> <div class="nov_2016_mvt_mobile"> <div class="nov_2016_product_info_container"> <div class="nov_2016_online_cddl_container"> <div class="nov_2016_online_cddl_buttons zerofont"> <!-- online --> <input value="online" type="radio" class="nov_2016_online_cddl" name="nov_2016_online_cddl" autocomplete="off" id="nov_2016_online" checked> <label for="nov_2016_online"> Online </label> <!-- cd/download --> <input value="cddl" type="radio" class="nov_2016_online_cddl" name="nov_2016_online_cddl" autocomplete="off" id="nov_2016_cddl"> <label for="nov_2016_cddl"> Download/CD </label> </div> </div> <!-- online image --> <img class="nov_2016_prod_img nov_2016_img_online js_nov_2016_online" src="http://www.rosettastone.com/lp/spo/mobile_sbsr_nov_2016/assets/nov_2016_devices.png"> <!-- cd/download image --> <img style="display:none;" class="nov_2016_prod_img nov_2016_img_online js_nov_2016_cddl" src="http://www.rosettastone.com/lp/spo/mobile_sbsr_nov_2016/assets/nov_2016_cddl.png"> <div class="nov_2016_language_header"> Learn <span class="js_langname_1">a Language</span> </div> <div class="nov_2016_language_subhead"> with Rosetta&nbsp;Stone </div> <div class="nov_2016_review_star_container"> <div class="hollow_stars"> &#9734; &#9734; &#9734; &#9734; &#9734; <div class="filled_stars"> &#9733; &#9733; &#9733; &#9733; &#9733; </div> </div> </div> <div class="nov_2016_product_intro"> If speaking <span class="js_langname_1">a new language</span> in the real world is your goal, you\'ve come to the right place. Our program lets you learn your second language the way you learned your first, with an intuitive, immersive method that\'s as fun to use as it is effective. </div> <!-- online product bullets --> <ul class="nov_2016_ul js_nov_2016_online"> <li>Unlimited access to all 5 levels for selected duration</li> <!-- <li>Access for 1 person</li> --> <li>Speech Recognition</li> <li>Learn anywhere on any device including use of our award-winning mobile app</li> </ul> <!-- cd/download bullets --> <ul class="nov_2016_ul js_nov_2016_cddl"> <li>Learn at your own pace with our course that never&nbsp;expires</li> <li>Access for up to 5 family members</li> <li>Speech Recognition</li> <li>No internet connection required</li> </ul> </div> <div class="nov_2016_purchase_section"> <div class="nov_2016_select_title"> Select the product that\'s right for you </div> <!-- online product radios --> <div class="nov_2016_product_radios js_nov_2016_online"> <label> <input type="radio" name="nov_2016_sub_length" autocomplete="off" data-lvl="03" checked> <span class="js_product_name">3-Month Subscription</span> <span class="nov_2016_radio_prices"> <span class="nov_2016_radio_msrp js_msrp_hider"> $<span class="js_nov_2016_msrp" data-media="subscription" data-lvl="03">XX</span> </span> <span class="nov_2016_radio_price"> $<span class="js_nov_2016_price" data-media="subscription" data-lvl="03">XX</span> </span> </span> </label> <label> <input type="radio" name="nov_2016_sub_length" autocomplete="off" data-lvl="06"> <span class="js_product_name">6-Month Subscription</span> <span class="nov_2016_radio_prices"> <span class="nov_2016_radio_msrp js_msrp_hider"> $<span class="js_nov_2016_msrp" data-media="subscription" data-lvl="06">XX</span> </span> <span class="nov_2016_radio_price"> $<span class="js_nov_2016_price" data-media="subscription" data-lvl="06">XX</span> </span> </span> </label> <label> <input type="radio" name="nov_2016_sub_length" autocomplete="off" data-lvl="12"> <span class="js_product_name">12-Month Subscription</span> <span class="nov_2016_radio_prices"> <span class="nov_2016_radio_msrp js_msrp_hider"> $<span class="js_nov_2016_msrp" data-media="subscription" data-lvl="12">XX</span> </span> <span class="nov_2016_radio_price"> $<span class="js_nov_2016_price" data-media="subscription" data-lvl="12">XX</span> </span> </span> </label> <label> <input type="radio" name="nov_2016_sub_length" autocomplete="off" data-lvl="24"> <span class="js_product_name">24-Month Subscription</span> <span class="nov_2016_radio_prices"> <span class="nov_2016_radio_msrp js_msrp_hider"> $<span class="js_nov_2016_msrp" data-media="subscription" data-lvl="24">XX</span> </span> <span class="nov_2016_radio_price"> $<span class="js_nov_2016_price" data-media="subscription" data-lvl="24">XX</span> </span> </span> </label> </div> <!-- cd/download toggle --> <div class="nov_2016_product_radios nov_2016_cddl_radios js_nov_2016_cddl"> <label> <input type="radio" name="nov_2016_cddl_toggle" autocomplete="off" data-media="download" checked> <span class="js_product_name">Instant Download</span> </label> <label> <input type="radio" name="nov_2016_cddl_toggle" autocomplete="off" data-media="box"> <span class="js_product_name">CD-ROM Set</span> </label> </div> <!-- cd/download levels --> <div class="nov_2016_product_radios js_nov_2016_cddl"> <label> <input type="radio" name="nov_2016_cddl_lvl" autocomplete="off" data-lvl="L1" checked> <span class="js_product_name">Level 1</span> <span class="nov_2016_radio_prices"> <span class="nov_2016_radio_msrp js_msrp_hider"> $<span class="js_nov_2016_msrp js_update_cddl" data-media="download" data-lvl="L1">XX</span> </span> <span class="nov_2016_radio_price"> $<span class="js_nov_2016_price js_update_cddl" data-media="download" data-lvl="L1">XX</span> </span> </span> </label> <label> <input type="radio" name="nov_2016_cddl_lvl" autocomplete="off" data-lvl="S3"> <span class="js_product_name">Levels 1-3</span> <span class="nov_2016_radio_prices"> <span class="nov_2016_radio_msrp js_msrp_hider"> $<span class="js_nov_2016_msrp js_update_cddl" data-media="download" data-lvl="S3">XX</span> </span> <span class="nov_2016_radio_price"> $<span class="js_nov_2016_price js_update_cddl" data-media="download" data-lvl="S3">XX</span> </span> </span> </label> <label> <input type="radio" name="nov_2016_cddl_lvl" autocomplete="off" data-lvl="S5"> <span class="js_product_name">Levels 1-5</span> <span class="nov_2016_radio_prices"> <span class="nov_2016_radio_msrp js_msrp_hider"> $<span class="js_nov_2016_msrp js_update_cddl" data-media="download" data-lvl="S5">XX</span> </span> <span class="nov_2016_radio_price"> $<span class="js_nov_2016_price js_update_cddl" data-media="download" data-lvl="S5">XX</span> </span> </span> </label> </div> <!-- pricing section --> <div class="nov_2016_product_square js_nov_2016_product"> <div class="nov_2016_product_square_content"> <div class="nov_2016_product_square_header js_show_product_name"> 3-Month Subscription </div> <div class="nov_2016_product_square_middle zerofont"> <!-- price --> <div class="nov_2016_price_container_square"> <span class="nov_2016_big_price_square js_nov_2016_price no_month js_update_lvl js_update_media" data-lvl="03" data-media="subscription">XX</span> </div> <!-- msrp --> <div class="nov_2016_msrp_square js_msrp_hider"> Regular <span class="nov_2016_multipay_strikeprice_square">$<span class="js_nov_2016_msrp js_update_lvl js_update_media" data-lvl="03" data-media="subscription">XX</span></span> </div> <!-- gifting --> <label class="nov_2016_gifting_square"> <input type="checkbox" autocomplete="off" class="js_nov_2016_gifting"> <span>Give as a gift!</span> </label> </div> </div> </div> <!-- cart button --> <a class="nov_2016_addtocart_square js_nov_2016_addtocart js_update_lvl js_update_media" data-lang="esp" data-media="subscription" data-lvl="03" data-gifting="" href="#">Add to Cart</a> <!-- guarantee --> <div class="nov_2016_guarantee_vertical"> <div class="nov_2016_guarantee_line2">30-Day, Money-Back Guarantee.</div> </div> </div> </div> <!-- end multivariate test html -->';

	// insert new content
	$('#products-mobile form').before(content);




	// full test script

/********************************************
SET CART BEHAVIOR BEFORE LANGUAGE IS SELECTED
*********************************************/

function set_up_pre_language(){
	$('.js_nov_2016_addtocart').html('Select Language').on('click',function(){
		smoothScrollTo('#products-mobile');
		return false;
	});
}
set_up_pre_language();


/***********************************************************************
SMOOTH SCROLL
************************************************************************/
function smoothScrollTo(scrolltargetid){
	var target = document.getElementById(scrolltargetid); 
	if(target){
		$('html,body').animate({scrollTop : target.getBoundingClientRect().top + window.scrollY}, 'fast');
	}
}



// show or hide test depending on whether language is preselected

(function(){
	// get preselected lang (if there is one)
	var lang = getLangUrlParam();

	// if no lang selected or is figs, show test
	if(!lang || isFIGS(lang)){
		show_test();
	}
	// for other languages, hide test
	else{
		hide_test();
	}
})();




// css fix
$('#products-mobile .container').css({'width':'auto'});



// on language change
$('#dropdown-language, #temporary_lang_dropdown').on('change', function(){
	var lang = this.value;

	$(document).trigger('product_change', {
		'lang': lang
	});
});

// if figs lang url parameter
if( isFIGS(getLangUrlParam()) ){
	$(document).trigger('product_change', {
		'lang': getLangUrlParam()
	});
}

function getLangUrlParam(){
	return ( (window.location.search.match(/lang(uage)*=([^&]+)/i)||[])[2] || '').toLowerCase();
}



// on change product lvl
$('input[name=nov_2016_sub_length], input[name=nov_2016_cddl_lvl]').on('change', function(){
	var lvl = this.getAttribute('data-lvl');

	$(document).trigger('product_change', {
		'lvl': lvl
	});
});

// on toggle cd/dl
$('input[name=nov_2016_cddl_toggle]').on('change', function(){
	var media = $(this).attr('data-media');

	$(document).trigger('product_change', {
		'media': media
	});
});



// on toggle online/cddl
$('.nov_2016_online_cddl').on('change', function(){
	var tab = this.value;

	var media;

	if(tab==='online'){
		media = 'subscription';

		$('.js_nov_2016_online').show();
		$('.js_nov_2016_cddl').hide();
	}
	else{
		media = $('input[name=nov_2016_cddl_toggle]:checked').attr('data-media');

		$('.js_nov_2016_online').hide();
		$('.js_nov_2016_cddl').show();
	}
	

	$(document).trigger('product_change', {
		'media': media
	});
});




function show_test(){
	$('.nov_2016_mvt_mobile').show();
	$('#products-mobile form, #products-mobile > .container > img').hide();
}

function hide_test(){
	$('.nov_2016_mvt_mobile').hide();
	$('#products-mobile form, #products-mobile > .container > img').show();
}


function check_if_s5_available(lang){

	// if S5 selected but S5 not available
	if(!hasS5(lang)){

		// hide S5
		$('input[data-lvl=S5]').closest('label').hide();

		// if current product is S5, switch to S3
		if($('.js_nov_2016_addtocart').attr('data-lvl')==='S5'){
			$('input[data-lvl=S3]').click();
		}
	}

	// if S5 is available, show it
	if(hasS5(lang)){
		// show S5
		$('input[data-lvl=S5]').closest('label').show();
	}
}

$(document).on('product_change', function(e,data){

	if(data.lang){

		check_if_s5_available(data.lang);

		// if figs, show test
		if(isFIGS(data.lang)){
			show_test();

			// restore cart button functionality now that we have a language
			$('.js_nov_2016_addtocart').off('click').html('Add to Cart');

			// update language
			update_lang(data.lang);
			update_view();
		}

		// if figs, hide test
		else{
			hide_test();
		}

	}

	if(data.lvl){
		update_lvl(data.lvl);
		update_view();
	}
	if(data.media){
		update_media(data.media);

		check_if_s5_available( $('.js_nov_2016_addtocart').attr('data-lang') );

		update_view();
	}
});

// can turn figs-only state on or off (using true or false)
function isFIGS(lang){
	var figs_only = false;
	return figs_only ? /esp|fra|ita|deu/i.test(lang) : true;
}

function hasS5(lang){
	return !!RSI({cat:lang,lvl:'S5'})[0];
}

function update_lang(lang){
	var langmap = {
		esp: 'Spanish',
		eng: 'English',
		fra: 'French',
		deu: 'German',
		ita: 'Italian',
		ara: 'Arabic',
		chi: 'Chinese',
		ned: 'Dutch',
		ebr: 'English',
		tgl: 'Filipino',
		grk: 'Greek',
		heb: 'Hebrew',
		hin: 'Hindi',
		gle: 'Irish',
		jpn: 'Japanese',
		kor: 'Korean',
		far: 'Persian',
		pol: 'Polish',
		por: 'Portuguese',
		rus: 'Russian',
		esc: 'Spanish',
		sve: 'Swedish',
		tur: 'Turkish',
		vie: 'Vietnamese'
	}

	// update lang names
	$('.js_langname_1').html(langmap[lang]);

	// update cart btn data-lang
	$('.js_nov_2016_addtocart').attr('data-lang',lang);
}


function update_lvl(lvl){

	var product_name = $('input[type=radio][data-lvl='+lvl+'] ~ .js_product_name').html();
	$('.js_show_product_name').html(product_name);

	// update data attribs for price, msrp, cartbtn
	$('.js_update_lvl').attr('data-lvl',lvl);
}

function update_media(media){

	// update data-media
	$('.js_update_media').attr('data-media',media);

	// if cddl only, update where needed
	if(media!=='subscription'){
		$('.js_update_cddl').attr('data-media',media);
	}

	// then make sure lvl is possible for current media

	var selector;

	// if subscription get lvl from sub radios
	if(media==='subscription'){
		selector = 'input[name=nov_2016_sub_length]:checked';
	}

	// else get lvl from cddl radios
	else{
		selector = 'input[name=nov_2016_cddl_lvl]:checked';
	}

	var lvl = $(selector).attr('data-lvl');

	update_lvl(lvl);
}




function update_prices(){
	$('.js_nov_2016_price').html(function(){
		var media = this.getAttribute('data-media');
		var lvl = this.getAttribute('data-lvl');




		var price = RSI({media:media, lvl:lvl})[0].price;
		return price;
	});
}

function update_msrps(){
	$('.js_nov_2016_msrp').html(function(){
		var media = this.getAttribute('data-media');
		var lvl = this.getAttribute('data-lvl');
		var price = RSI({media:media, lvl:lvl})[0].price;
		var msrp = RSI({media:media, lvl:lvl})[0].msrp;

		// hide msrp if same as price
		if(price===msrp){
			$(this).closest('.js_msrp_hider').hide();
		}

		return msrp;
	});
}

function update_gifting(){
	var gifting_is_checked = document.querySelector('.js_nov_2016_gifting').checked;
	if(gifting_is_checked){
		$('.js_nov_2016_addtocart').attr('data-gifting','true');
	}
	else{
		$('.js_nov_2016_addtocart').attr('data-gifting','');
	}
}

// handle gifting checkbox input
$('.js_nov_2016_gifting').on('change',function(){
	update_gifting();
	update_cart();
});

function update_cart(){
	$('.js_nov_2016_addtocart').attr('href', function(){
		var lang = this.getAttribute('data-lang');
		var media = this.getAttribute('data-media');
		var lvl = this.getAttribute('data-lvl');
		var gifting = this.getAttribute('data-gifting');

		var carturl = RSI({cat:lang, media:media, lvl:lvl})[0].cart;

		var separator = carturl.match(/\?/) ? '&' : '?';

		if(gifting){
			carturl += separator + 'gifting=1';
		}

		return carturl;
	});
}

function update_view(){
	update_prices();
	update_msrps();
	update_gifting();
	update_cart();
}

update_view();




// fix because sbsr mobile uses esp by default
(function(){
	var lang = $('#dropdown-language').val();

	// if lang code selected
	if(lang.length===3){

		// set that as the lang
		$(document).trigger('product_change', {
			'lang': lang
		});
	}
})();







});