var start_price = 0;

function set_option(theID){
	//set form ID
	document.getElementById('f_chosenOption').value = theID;
	
	//now set price
	var new_price = base_price;
	if(price_array[theID]){
		new_price += price_array[theID];
		//new_price += 2.22;
		changePrice(new_price);		
	}
	else{
		changePrice(base_price);			
	}	
}

function go_next(){
	var chosen_id = document.getElementById('f_chosenOption').value;
	var step = document.getElementById('f_currentStep').value;
	//var engraving = document.getElementById('lasering').value;
	
	if(step == 'lasering'){
		//alert("At this point, a user will be brought to a confirmation page, and then API magic will add the item to the Crosman Cart");
		var engraving = document.getElementById('lasering').value;			
		document.getElementById('f_chosenOption').value = engraving;			
		document.getElementById('customStoreForm').submit();	
	}
	else if(chosen_id == 'default'){
		alert("You must select a part to continue.");
	}
	else{
		document.getElementById('customStoreForm').submit();	
	}
}

//shiftIt(1, 409);
		function shiftIt(howMany, theOffset){
			var theDiv = document.getElementById('main-image');
			
			var startX=0;
			var theOffset = theOffset;
			for(var i = 0;i<howMany;i++){
				startX+=theOffset;
			}			
			theDiv.style.backgroundPosition = "-"+startX+"px 0";			
		}

function changePrice(new_price){
	document.getElementById('the-price').innerHTML = new_price.toFixed(2);
}

function init_custom_gun(){
	//alert(document.getElementById('the-price').innerHTML);
	//document.getElementById('the-price').innerHTML = start_price;
	if(base_price){
		changePrice(base_price);
	}
}

function checkAge(theCheckbox){
	if(theCheckbox.checked){
		theStyle = 'visible';
	}
	else{
		theStyle = 'hidden';	
	}
	
	document.getElementById('theSubmit').style.visibility = theStyle;
}

function checkWarrenty(theCheckbox){
	if(theCheckbox.checked){
		changePrice(base_price+10);
	}
	else{
		changePrice(base_price);
	}
}

//changePrice(100.00);