	$(document).ready(function(){
		
	// ********************************Calculate total price**************************
	function totalUp() {				
		$total = 0;
		$users = 0;			
		$('select[name=sfid]').each(function(i){
			name = $(this).children('option:selected').attr('name');
			$total = Number($total + Number(name.split(",")[2]));
			$users = parseInt($users + parseInt(name.split(",")[1] ));
		});	
				
		$('input[type=checkbox][name=sfid]:checked').each(function(i){
			$total = $total + parseInt($(this).attr('title') );
		});	
		
		$perUser = addCommas(($total/$users).toFixed(2));
		$('#total').html('$' + addCommas(Number($total).toFixed(2)) + '/month <span class="unbold">or</span> $' + addCommas(Number($total*12).toFixed(2)) + '/year <em>(average of $' + $perUser + '/user/month)</em>');
		
		if ($users < 200){
			$('.sso').attr("checked", false);
			$('.sso').attr("disabled", true);
		} else {
			$('.sso').attr("disabled", false);
		};		
	};
	
	// **********************************Add commas to Numbers >999*********************************
	function addCommas(nStr){
		nStr += '';
		x = nStr.split('.');
		x1 = x[0];
		x2 = x.length > 1 ? '.' + x[1] : '';
		var rgx = /(\d+)(\d{3})/;
		while (rgx.test(x1)) {
			x1 = x1.replace(rgx, '$1' + ',' + '$2');
		};
		return x1 + x2;
	};
	// *****************Remove commas from Numbers >999 for use in math******************************
	function removeCommas(aNum) {
		aNum=aNum.replace(/,/g,"");
		return aNum;
	};
	
    // *******************Custom user number input*************************************
	function run(){
		$('.fivemin').hide(); //Hide the validation notice
		$('.over500').hide(); //Hide the second validation notice
		$('.popup').hide(); //Hide the custom number of users pop up
		setPricingText();
		$('select').click(function(){
			if ($(this).children('option:last:selected').length != "0") {
				$(this).siblings('.holder').children('.popup').fadeIn('fast'); //Pop up text box
			} else {
				$(this).siblings('.holder').children('.popup').hide(); //Hide text box
			}
		});	
		$('.hide_popup').click(function(){
			$customItem = $(this).parent().parent().prev().children('option:last-child'); //the last item in the dropdown
			$ciName = $customItem.attr('name').split(",")[0]; //base-line price of product
			$enteredNum = $(this).siblings('input').val(); //quantity entered by user
			//if less than 5 users or greater than 500 are entered, pop up appropriate validation message
			if ($enteredNum < 10 && $enteredNum >= 1) {
				$(this).siblings('.over500:visible').hide();
			    $(this).siblings('.fivemin').show();
			} else if ($enteredNum > 500 ) {
				$(this).siblings('.fivemin:visible').hide();
			    $(this).siblings('.over500').show();
			//if an acceptable value is entered
			} else if($enteredNum != "" && $enteredNum != "0"){
				$customItem.val($customItem.val().split('-')[0] + "-" + $enteredNum); //Add quantity to SF ID
				$customItem.attr('name', $ciName + "," + $enteredNum+",0"); //set name attribute to (price, number of users)
				 //set volume discounted price
				$numberOfUsers = $(this).parent().parent().prev().children('option:selected').attr('name').split(",")[1];
				if ($numberOfUsers >= 500){
					discountedPrice = Number(($ciName*.04*$numberOfUsers)/12);
				} else if ($numberOfUsers >= 250){
					discountedPrice = Number(($ciName*.06*$numberOfUsers)/12);
				} else if ($numberOfUsers >= 100){
					discountedPrice = Number(($ciName*.09*$numberOfUsers)/12);
				} else if ($numberOfUsers >= 50){
					discountedPrice = Number(($ciName*.12*$numberOfUsers)/12);
				} else if ($numberOfUsers >= 25){
					discountedPrice = Number(($ciName*.17*$numberOfUsers)/12);
				} else if ($numberOfUsers >= 5){
					discountedPrice = Number(($ciName*.25*$numberOfUsers)/12);
				};
				$customItem.attr('name', $ciName.split(",")[0]+","+$enteredNum+","+discountedPrice); //add volume discounted price to name attribute
				//set text of menu item
				perUserPrice = (discountedPrice/$customItem.attr('name').split(",")[1]).toFixed(2);
				$customItem.text("Up to "+$enteredNum+" users at $"+addCommas(Math.round(discountedPrice))+"/month ($"+perUserPrice+"/user) (click to edit)"); 
				//hide popup and  validation message
				$(this).siblings('.fivemin:visible').hide();
				$(this).siblings('.over500:visible').hide();
				$(this).parent('.popup').fadeOut('fast');
			//if number of users is blank or 0, clear custom setting and set menu to "None," close popup and validation
			} else if($enteredNum == "" || $enteredNum == "0"){
				$customItem.text("Custom Number of Users (click to edit)");
				$(this).siblings('.fivemin:visible').hide();
				$(this).siblings('.over500:visible').hide();
				$(this).parent().parent().prev().children('option[value="0"]').attr('selected', 'selected');
				$(this).parent('.popup').fadeOut('fast');
			};
			totalUp(); //Recalculate total price
			payPlan(); //Check whether annual or monthly option is selected
			
			return false;
		});
	};

	// **************************New Annual/Monthly Toggle***********************
	function payPlan(){
		
		if($('input[type=radio]:checked').val() == "1551"){
			
			$('input[type=checkbox][name=sfid]').each(function(i){
				$(this).next('.pricetext').text('$'+parseInt($(this).attr('title'))*12+'/year');
			});	
			
			$('input[name=sfid]').not('input[title=payplan]').each(function(){
				annualPrice = parseInt($(this).val())+1;
				$(this).val(annualPrice);
			});
			
			$('select[name=sfid] option').each(function(){
			if($(this).text() != "None" && $(this).text() != "Custom Number of Users (click to edit)" && $(this).text() != "Add content to existing categories (Included)" && $(this).text().indexOf('year') == "-1"){
				newPrice = addCommas(parseInt(removeCommas($(this).text().split('$')[1]))*12);
				newUserPrice = ((Number($(this).attr('name').split(',')[2])/Number($(this).attr('name').split(',')[1]))*12).toFixed(2);
				
					if($(this).text().indexOf('(click to edit)') != "-1"){
						editOption = ' (click to edit)';
					} else {
						editOption = '';
					};
				$(this).text($(this).text().split('$')[0]+'$'+newPrice+'/year ($'+newUserPrice+'/user)'+editOption);
				
				annualPrice = parseInt($(this).val().split('-')[0])+1;
				$(this).val(annualPrice+'-'+$(this).val().split('-')[1]);
				
				};
			});	
						
		} else if($('input[type=radio]:checked').val() == "1550"){
			
			$('input[type=checkbox][name=sfid]').each(function(){
				$(this).next('.pricetext').text('$'+parseInt($(this).attr('title'))+'/month');
			});	
		
						
			$('input[name=sfid]').not('input[title=payplan]').each(function(){
				annualPrice = parseInt($(this).val())-1;
				$(this).val(annualPrice);		
			});
			
			$('select[name=sfid] option').each(function(){
				if($(this).text() != "None" && $(this).text() != "Custom Number of Users (click to edit)" && $(this).text() != "Add content to existing categories (Included)" && $(this).text().indexOf('month') == "-1"){
					newPrice = addCommas(parseInt(removeCommas($(this).text().split('$')[1]))/12);
					newUserPrice = (Number($(this).attr('name').split(',')[2])/Number($(this).attr('name').split(',')[1])).toFixed(2);
					if($(this).text().indexOf('(click to edit)') != "-1"){
						editOption = ' (click to edit)';
					} else {
						editOption = '';
					};
					$(this).text($(this).text().split('$')[0]+'$'+newPrice+'/month ($'+newUserPrice+'/user)'+editOption);
					
					annualPrice = parseInt($(this).val().split('-')[0])-1;
					$(this).val(annualPrice+'-'+$(this).val().split('-')[1]);
				};
			});
		};
	
			$('select[name=sfid]').children('option:last-child').each(function(){
				annualPrice = $(this).prev('option').val().split('-')[0];
				$(this).val(annualPrice+'-'+$(this).val().split('-')[1]);
			});

		
	};


//********************************Set pricing***********************

	function setPricingText(){
		$('select[name=sfid] option').each(function(){
			if($(this).text() != "None" && $(this).text() != "Custom Number of Users (click to edit)" && $(this).text() != "Add content to existing categories (Included)"){
				basePrice = $(this).attr('name').split(',')[0];
				numberOfUsers = $(this).attr('name').split(',')[1];			
				if (numberOfUsers >= 500){
						newPrice = Number((basePrice*.04*numberOfUsers)/12).toFixed(2);
						$(this).attr('name', basePrice+','+numberOfUsers+','+newPrice);
					} else if (numberOfUsers >= 250){
						newPrice = Number((basePrice*.06*numberOfUsers)/12).toFixed(2);
						$(this).attr('name', basePrice+','+numberOfUsers+','+newPrice);
					} else if (numberOfUsers >= 100){
						newPrice = Number((basePrice*.09*numberOfUsers)/12).toFixed(2);
						$(this).attr('name', basePrice+','+numberOfUsers+','+newPrice);
					} else if (numberOfUsers >= 50){
						newPrice = Number((basePrice*.12*numberOfUsers)/12).toFixed(2);
						$(this).attr('name', basePrice+','+numberOfUsers+','+newPrice);
					} else if (numberOfUsers >= 25){
						newPrice = Number((basePrice*.17*numberOfUsers)/12).toFixed(2);
						$(this).attr('name', basePrice+','+numberOfUsers+','+newPrice);
					} else if (numberOfUsers >= 5){
						newPrice = Number((basePrice*.25*numberOfUsers)/12).toFixed(2);
						$(this).attr('name', basePrice+','+numberOfUsers+','+newPrice);
					};
				if($(this).text().indexOf('(click to edit)') != "-1"){editOption = ' (click to edit)'} else {editOption = ''};
				$(this).text($(this).text().split('$')[0]+'$'+Math.round(newPrice)+'/month ($'+(newPrice/numberOfUsers).toFixed(2)+'/user)'+editOption);
			};	
		});
	};

		
	added_courses = 3; //Set added_courses variable
	
	function courseChanger() {
		added_courses = added_courses+1;
		$('select.icname').click(function() {
			thisClass = $(this).parent('td').attr('class');
			
			if ($(this).val() == "access07"){
				$('td#icprice_' + thisClass).replaceWith('<td id="icprice_'+thisClass+'"><select class="new_course" name="sfid">\
				<option value="0" name="0,0,0">None</option>\
				<option selected value="1867-10" name="125,10,26">Up to 10 users at $26/month ($2.60/user)</option>\
				<option value="1867-25" name="125,25,44">Up to 25 users at $44/month ($1.76/user)</option>\
				<option value="1867-50" name="125,50,62">Up to 50 users at $62/month ($1.24/user)</option>\
				<option value="1867-100" name="125,100,93">Up to 100 users at $93/month ($0.93/user)</option>\
				<option value="1867-250" name="125,250,234">Up to 250 users at $234/month ($0.94/user)</option>\
				<option value="1867-500" name="125,500,208">Up to 500 users at $208/month ($0.42/user)</option>\
				<option value="1867" name="125,0,0">Custom Number of Users (click to edit)</option>\
		</select>\
		<div class="holder">\
		<div class="popup">\
			How many users? <input type="text" size="3" /><br />\
			<p class="fivemin">10 Users Minimum</p><p class="over500">Please contact us for 500+ users</p>\
			<a href="#" class="hide_popup">OK</a>\
		</div>\
		</div></td>');		
		run();		
		payPlan();
				
			};	//end if statement
			
			if ($(this).val() == "entourage08"){
				$('td#icprice_' + thisClass).replaceWith('<td id="icprice_'+thisClass+'"><select class="new_course" name="sfid">\
				<option value="0" name="0,0,0">None</option>\
				<option selected value="1869-10" name="39,10,8">Up to 10 users at $8/month ($1/user)</option>\
				<option value="1869-25" name="39,25,14">Up to 25 users at $14/month ($1/user)</option>\
				<option value="1869-50" name="39,50,20">Up to 50 users at $20/month ($0/user)</option>\
				<option value="1869-100" name="39,100,29">Up to 100 users at $29/month ($0/user)</option>\
				<option value="1869-250" name="39,250,45">Up to 250 users at $45/month ($0/user)</option>\
				<option value="1869-500" name="39,500,57">Up to 500 users at $57/month ($0/user)</option>\
				<option value="1869" name="39,0,0">Custom Number of Users (click to edit)</option>\
		</select>\
		<div class="holder">\
		<div class="popup">\
			How many users? <input type="text" size="3" /><br />\
			<p class="fivemin">10 Users Minimum</p><p class="over500">Please contact us for 500+ users</p>\
			<a href="#" class="hide_popup">OK</a>\
		</div>\
		</div></td>');	
		run();	
		payPlan();

			};	//end if statement 
			
			if ($(this).val() == "exchange05"){
				$('td#icprice_' + thisClass).replaceWith('<td id="icprice_'+thisClass+'"><select class="new_course" name="sfid">\
				<option value="0" name="0,0,0">None</option>\
				<option selected value="1871-10" name="279,10,58">Up to 10 users at $58/month ($6/user)</option>\
				<option value="1871-25" name="279,25,99">Up to 25 users at $99/month ($4/user)</option>\
				<option value="1871-50" name="279,50,140">Up to 50 users at $140/month ($3/user)</option>\
				<option value="1871-100" name="279,100,209">Up to 100 users at $209/month ($2/user)</option>\
				<option value="1871-250" name="279,250,320">Up to 250 users at $320/month ($1/user)</option>\
				<option value="1871-500" name="279,500,407">Up to 500 users at $407/month ($0/user)</option>\
				<option value="1871" name="279,0,0">Custom Number of Users (click to edit)</option>\
		</select>\
		<div class="holder">\
		<div class="popup">\
			How many users? <input type="text" size="3" /><br />\
			<p class="fivemin">10 Users Minimum</p><p class="over500">Please contact us for 500+ users</p>\
			<a href="#" class="hide_popup">OK</a>\
		</div>\
		</div></td>');	
		run();	
		payPlan();
				
			};	//end if statement
			
			if ($(this).val() == "office03"){
				$('td#icprice_' + thisClass).replaceWith('<td id="icprice_'+thisClass+'"><select class="new_course" name="sfid">\
				<option value="0" name="0,0,0">None</option>\
				<option selected value="1873-10" name="279,10,58">Up to 10 users at $58/month ($6/user)</option>\
				<option value="1873-25" name="279,25,99">Up to 25 users at $99/month ($4/user)</option>\
				<option value="1873-50" name="279,50,140">Up to 50 users at $140/month ($3/user)</option>\
				<option value="1873-100" name="279,100,209">Up to 100 users at $209/month ($2/user)</option>\
				<option value="1873-250" name="279,250,320">Up to 250 users at $320/month ($1/user)</option>\
				<option value="1873-500" name="279,500,407">Up to 500 users at $407/month ($0/user)</option>\
				<option value="1873" name="279,0,0">Custom Number of Users (click to edit)</option>\
		</select>\
		<div class="holder">\
		<div class="popup">\
			How many users? <input type="text" size="3" /><br />\
			<p class="fivemin">10 Users Minimum</p><p class="over500">Please contact us for 500+ users</p>\
			<a href="#" class="hide_popup">OK</a>\
		</div>\
		</div></td>');	
		run();	
		payPlan();	
				
			};	//end if statement
			
			if ($(this).val() == "office07"){
				$('td#icprice_' + thisClass).replaceWith('<td id="icprice_'+thisClass+'"><select class="new_course" name="sfid">\
				<option value="0" name="0,0,0">None</option>\
				<option selected value="1875-10" name="379,10,79">Up to 10 users at $79/month ($8/user)</option>\
				<option value="1875-25" name="379,25,134">Up to 25 users at $134/month ($5/user)</option>\
				<option value="1875-50" name="379,50,190">Up to 50 users at $190/month ($4/user)</option>\
				<option value="1875-100" name="379,100,284">Up to 100 users at $284/month ($3/user)</option>\
				<option value="1875-250" name="379,250,434">Up to 250 users at $434/month ($2/user)</option>\
				<option value="1875-500" name="379,500,553">Up to 500 users at $553/month ($1/user)</option>\
				<option value="1875" name="379,0,0">Custom Number of Users (click to edit)</option>\
		</select>\
		<div class="holder">\
		<div class="popup">\
			How many users? <input type="text" size="3" /><br />\
			<p class="fivemin">10 Users Minimum</p><p class="over500">Please contact us for 500+ users</p>\
			<a href="#" class="hide_popup">OK</a>\
		</div>\
		</div></td>');	
		run();	
		payPlan();
				
			};	//end if statement
			
			if ($(this).val() == "macoffice08"){
				$('td#icprice_' + thisClass).replaceWith('<td id="icprice_'+thisClass+'"><select class="new_course" name="sfid">\
				<option value="0" name="0,0,0">None</option>\
				<option selected value="1877-10" name="99,10,21">Up to 10 users at $21/month ($2/user)</option>\
				<option value="1877-25" name="99,25,35">Up to 25 users at $35/month ($1/user)</option>\
				<option value="1877-50" name="99,50,50">Up to 50 users at $50/month ($1/user)</option>\
				<option value="1877-100" name="99,100,74">Up to 100 users at $74/month ($1/user)</option>\
				<option value="1877-250" name="99,250,113">Up to 250 users at $113/month ($0/user)</option>\
				<option value="1877-500" name="99,500,144">Up to 500 users at $144/month ($0/user)</option>\
				<option value="1877" name="99,0,0">Custom Number of Users (click to edit)</option>\
		</select>\
		<div class="holder">\
		<div class="popup">\
			How many users? <input type="text" size="3" /><br />\
			<p class="fivemin">10 Users Minimum</p><p class="over500">Please contact us for 500+ users</p>\
			<a href="#" class="hide_popup">OK</a>\
		</div>\
		</div></td>');	
		run();	
		payPlan();	
				
			};	//end if statement
		
		if ($(this).val() == "outlook07"){
				$('td#icprice_' + thisClass).replaceWith('<td id="icprice_'+thisClass+'"><select class="new_course" name="sfid">\
				<option value="0" name="0,0,0">None</option>\
				<option selected value="1879-10" name="129,10,27">Up to 10 users at $27/month ($3/user)</option>\
				<option value="1879-25" name="129,25,46">Up to 25 users at $46/month ($2/user)</option>\
				<option value="1879-50" name="129,50,65">Up to 50 users at $65/month ($1/user)</option>\
				<option value="1879-100" name="129,100,97">Up to 100 users at $97/month ($1/user)</option>\
				<option value="1879-250" name="129,250,148">Up to 250 users at $148/month ($1/user)</option>\
				<option value="1879-500" name="129,500,188">Up to 500 users at $188/month ($0/user)</option>\
				<option value="1879" name="129,0,0">Custom Number of Users (click to edit)</option>\
		</select>\
		<div class="holder">\
		<div class="popup">\
			How many users? <input type="text" size="3" /><br />\
			<p class="fivemin">10 Users Minimum</p><p class="over500">Please contact us for 500+ users</p>\
			<a href="#" class="hide_popup">OK</a>\
		</div>\
		</div></td>');	
		run();
		payPlan();	 	
				
			};	//end if statement
			
		if ($(this).val() == "project07"){
				$('td#icprice_' + thisClass).replaceWith('<td id="icprice_'+thisClass+'"><p>Please call us at 1-800-949-5590 for a quote.</p></td>');	
		run();	
		payPlan();
				
			};	//end if statement
			
		if ($(this).val() == "sharepoint07"){
				$('td#icprice_' + thisClass).replaceWith('<td id="icprice_'+thisClass+'"><select class="new_course" name="sfid">\
				<option value="0" name="0,0,0">None</option>\
				<option selected value="1886-10" name="99,10,21">Up to 10 users at $21/month ($2/user)</option>\
				<option value="1886-25" name="99,25,35">Up to 25 users at $35/month ($1/user)</option>\
				<option value="1886-50" name="99,50,50">Up to 50 users at $50/month ($1/user)</option>\
				<option value="1886-100" name="99,100,74">Up to 100 users at $74/month ($1/user)</option>\
				<option value="1886-250" name="99,250,113">Up to 250 users at $113/month ($0/user)</option>\
				<option value="1886-500" name="99,500,144">Up to 500 users at $144/month ($0/user)</option>\
				<option value="1886" name="99,0,0">Custom Number of Users (click to edit)</option>\
		</select>\
		<div class="holder">\
		<div class="popup">\
			How many users? <input type="text" size="3" /><br />\
			<p class="fivemin">10 Users Minimum</p><p class="over500">Please contact us for 500+ users</p>\
			<a href="#" class="hide_popup">OK</a>\
		</div>\
		</div></td>');	
		run();	
		payPlan();
			
				
			};	//end if statement	
			
		if ($(this).val() == "sbs03"){
				$('td#icprice_' + thisClass).replaceWith('<td id="icprice_'+thisClass+'"><select class="new_course" name="sfid">\
				<option value="0" name="0,0,0">None</option>\
				<option selected value="1888-10" name="249,10,52">Up to 10 users at $52/month ($5/user)</option>\
				<option value="1888-25" name="249,25,88">Up to 25 users at $88/month ($4/user)</option>\
				<option value="1888-50" name="249,50,125">Up to 50 users at $125/month ($2/user)</option>\
				<option value="1888-100" name="249,100,187">Up to 100 users at $187/month ($2/user)</option>\
				<option value="1888-250" name="249,250,285">Up to 250 users at $285/month ($1/user)</option>\
				<option value="1888-500" name="249,500,363">Up to 500 users at $363/month ($0/user)</option>\
				<option value="1888" name="249,0,0">Custom Number of Users (click to edit)</option>\
		</select>\
		<div class="holder">\
		<div class="popup">\
			How many users? <input type="text" size="3" /><br />\
			<p class="fivemin">10 Users Minimum</p><p class="over500">Please contact us for 500+ users</p>\
			<a href="#" class="hide_popup">OK</a>\
		</div>\
		</div></td>');	
		run();	
		payPlan();
			
				
			};	//end if statement
			
		if ($(this).val() == "sql05"){
				$('td#icprice_' + thisClass).replaceWith('<td id="icprice_'+thisClass+'"><select class="new_course" name="sfid">\
				<option value="0" name="0,0,0">None</option>\
				<option selected value="1890-10" name="279,10,58">Up to 10 users at $58/month ($6/user)</option>\
				<option value="1890-25" name="279,25,99">Up to 25 users at $99/month ($4/user)</option>\
				<option value="1890-50" name="279,50,140">Up to 50 users at $140/month ($3/user)</option>\
				<option value="1890-100" name="279,100,209">Up to 100 users at $209/month ($2/user)</option>\
				<option value="1890-250" name="279,250,320">Up to 250 users at $320/month ($1/user)</option>\
				<option value="1890-500" name="279,500,407">Up to 500 users at $407/month ($0/user)</option>\
				<option value="1890" name="279,0,0">Custom Number of Users (click to edit)</option>\
		</select>\
		<div class="holder">\
		<div class="popup">\
			How many users? <input type="text" size="3" /><br />\
			<p class="fivemin">10 Users Minimum</p><p class="over500">Please contact us for 500+ users</p>\
			<a href="#" class="hide_popup">OK</a>\
		</div>\
		</div></td>');	
		run();		
		payPlan();
		
				
			};	//end if statement
			
		if ($(this).val() == "visualbasic05"){
				$('td#icprice_' + thisClass).replaceWith('<td id="icprice_'+thisClass+'"><select class="new_course" name="sfid">\
				<option value="0" name="0,0,0">None</option>\
				<option selected value="1892-10" name="249,10,52">Up to 10 users at $52/month ($5/user)</option>\
				<option value="1892-25" name="249,25,88">Up to 25 users at $88/month ($4/user)</option>\
				<option value="1892-50" name="249,50,125">Up to 50 users at $125/month ($2/user)</option>\
				<option value="1892-100" name="249,100,187">Up to 100 users at $187/month ($2/user)</option>\
				<option value="1892-250" name="249,250,285">Up to 250 users at $285/month ($1/user)</option>\
				<option value="1892-500" name="249,500,363">Up to 500 users at $363/month ($0/user)</option>\
				<option value="1892" name="249,0,0">Custom Number of Users (click to edit)</option>\
		</select>\
		<div class="holder">\
		<div class="popup">\
			How many users? <input type="text" size="3" /><br />\
			<p class="fivemin">10 Users Minimum</p><p class="over500">Please contact us for 500+ users</p>\
			<a href="#" class="hide_popup">OK</a>\
		</div>\
		</div></td>');	
		run();
		payPlan();
			
				
			};	//end if statement
			
		if ($(this).val() == "winserver03"){
				$('td#icprice_' + thisClass).replaceWith('<td id="icprice_'+thisClass+'"><select class="new_course" name="sfid">\
				<option value="0" name="0,0,0">None</option>\
				<option selected value="1894-10" name="495,10,103">Up to 10 users at $103/month ($10/user)</option>\
				<option value="1894-25" name="495,25,175">Up to 25 users at $175/month ($7/user)</option>\
				<option value="1894-50" name="495,50,248">Up to 50 users at $248/month ($5/user)</option>\
				<option value="1894-100" name="495,100,371">Up to 100 users at $371/month ($4/user)</option>\
				<option value="1894-250" name="495,250,567">Up to 250 users at $567/month ($2/user)</option>\
				<option value="1894-500" name="495,500,722">Up to 500 users at $363/month ($1/user)</option>\
				<option value="1894" name="495,0,0">Custom Number of Users (click to edit)</option>\
		</select>\
		<div class="holder">\
		<div class="popup">\
			How many users? <input type="text" size="3" /><br />\
			<p class="fivemin">10 Users Minimum</p><p class="over500">Please contact us for 500+ users</p>\
			<a href="#" class="hide_popup">OK</a>\
		</div>\
		</div></td>');	
		run();
		payPlan();
		
				
			};	//end if statement
			
		if ($(this).val() == "mindmanager7"){
				$('td#icprice_' + thisClass).replaceWith('<td id="icprice_'+thisClass+'"><select class="new_course" name="sfid">\
				<option value="0" name="0,0,0">None</option>\
				<option selected value="1896-10" name="495,10,10">Up to 10 users at $10/month ($1/user)</option>\
				<option value="1896-25" name="495,25,17">Up to 25 users at $17/month ($1/user)</option>\
				<option value="1896-50" name="495,50,25">Up to 50 users at $25/month ($0/user)</option>\
				<option value="1896-100" name="495,100,37">Up to 100 users at $37/month ($0/user)</option>\
				<option value="1896-250" name="495,250,56">Up to 250 users at $56/month ($0/user)</option>\
				<option value="1896-500" name="495,500,71">Up to 500 users at $71/month ($0/user)</option>\
				<option value="1896" name="495,0,0">Custom Number of Users (click to edit)</option>\
		</select>\
		<div class="holder">\
		<div class="popup">\
			How many users? <input type="text" size="3" /><br />\
			<p class="fivemin">10 Users Minimum</p><p class="over500">Please contact us for 500+ users</p>\
			<a href="#" class="hide_popup">OK</a>\
		</div>\
		</div></td>');	
		run();
		payPlan();
		
				
			};	//end if statement
			
		});
	};
	
	$('.add_new').click(function(){
		$('#step_one tr:last').prev('tr').before('<tr><td class="'+added_courses+'"><select class="icname">\
			<option value="access07">Microsoft Access 2007</option>\
			<option value="entourage08">Microsoft Entourage 2008</option>\
			<option value="exchange05">Microsoft Exchange Server 2005</option>\
			<option value="office03">Microsoft Office 2003</option>\
			<option value="office07">Microsoft Office 2007</option>\
			<option value="macoffice08">Microsoft Office 2008 for Mac</option>\
			<option value="outlook07">Microsoft Outlook 2007</option>\
			<option value="project07">Microsoft Project 2007</option>\
			<option value="sharepoint07">Microsoft Sharepoint 2007 Complete</option>\
			<option value="sbs03">Microsoft Small Business Server 2003</option>\
			<option value="sql05">Microsoft SQL Server 2005</option>\
			<option value="visualbasic05">Microsoft Visual Basic 2005</option>\
			<option value="winserver03">Microsoft Windows Server 2003</option>\
			<option value="mindmanger7">Mindjet MindManager Pro 7</option>\
		</select></td>\
		<td id="icprice_'+added_courses+'"><select class="new_course" name="sfid">\
			<option value="0" name="0,0,0">None</option>\
			<option selected value="1867-10" name="125,10,26">Up to 10 users at $26/month ($3/user)</option>\
			<option value="1867-25" name="125,25,44">Up to 25 users at $44/month ($2/user)</option>\
			<option value="1867-50" name="125,50,63">Up to 50 users at $63/month ($1/user)</option>\
			<option value="1867-100" name="125,100,94">Up to 100 users at $94/month ($1/user)</option>\
			<option value="1867-250" name="125,250,143">Up to 250 users at $143/month ($1/user)</option>\
			<option value="1867-500" name="125,500,182">Up to 500 users at $182/month ($0/user)</option>\
			<option value="1867" name="125,0,0">Custom Number of Users (click to edit)</option>\
		</select>\
		<div class="holder">\
		<div class="popup">\
			How many users? <input type="text" size="3" /><br />\
			<p class="fivemin">10 Users Minimum</p><p class="over500">Please contact us for 500+ users</p>\
			<a href="#" class="hide_popup">OK</a>\
		</div>\
		</div></td></tr>');
		
		courseChanger();
		run();
		totalUp();
		payPlan();
		return false;
	});	
		
		//When a select or checkbox is click, calculate new total.
		$('select'|'input[type=checkbox]').click(function(){
			totalUp();
		});
		
		//Change quanity based on annual or monthly payment method.
		$('input[type=radio]').click(function(){
			payPlan();
		});
	
	run();	
	totalUp();
	courseChanger();
			
	});