function setPutterDetailPic( image, flag ) {
	document.getElementById('detailImage').src = '/images/' + image
	// this sets the image stuff for the slimbox.css
	if(flag) 	{
		var len = image.length
		var start = image.length - 5
		var letter = image.substr(start, 1)
		document.getElementById('detailLink').href = '/images/' + image.substr(0, (image.length - 4)) + '_L.jpg'
		if(letter == 'A') {
			document.getElementById('detailLink2').href = '/images/' + image.substr(0, (image.length - 5)) + 'B_L.jpg'
			document.getElementById('detailLink3').href = '/images/' + image.substr(0, (image.length - 5)) + 'C_L.jpg'
			document.getElementById('detailLink4').href = '/images/' + image.substr(0, (image.length - 5)) + 'D_L.jpg'
		}
		if(letter == 'B') {
			document.getElementById('detailLink2').href = '/images/' + image.substr(0, (image.length - 5)) + 'C_L.jpg'
			document.getElementById('detailLink3').href = '/images/' + image.substr(0, (image.length - 5)) + 'D_L.jpg'
			document.getElementById('detailLink4').href = '/images/' + image.substr(0, (image.length - 5)) + 'A_L.jpg'
		}
		if(letter == 'C') {
			document.getElementById('detailLink2').href = '/images/' + image.substr(0, (image.length - 5)) + 'D_L.jpg'
			document.getElementById('detailLink3').href = '/images/' + image.substr(0, (image.length - 5)) + 'A_L.jpg'
			document.getElementById('detailLink4').href = '/images/' + image.substr(0, (image.length - 5)) + 'B_L.jpg'
		}
		if(letter == 'D') {
			document.getElementById('detailLink2').href = '/images/' + image.substr(0, (image.length - 5)) + 'A_L.jpg'
			document.getElementById('detailLink3').href = '/images/' + image.substr(0, (image.length - 5)) + 'B_L.jpg'
			document.getElementById('detailLink4').href = '/images/' + image.substr(0, (image.length - 5)) + 'C_L.jpg'
		}
	}
}


function display_results ( active, total) {
	var activate = 'results_' + active
	var deactivate = ''
	for( var i = 0; i < total; i ++ ) {
		deactivate = 'results_' + i
		document.getElementById(deactivate).style.display = 'none';
	}
	document.getElementById(activate).style.display = 'block';
}

function putterPageImageSwap ( section ) {
	if(section == 'grip') {
		var parts = document.getElementById('grip').value.split('%')
		document.getElementById('grip_pic').src = '/images/products/' + parts[0] + 'A_S.jpg'
	}
	if(section == 'headcover') {
		var parts = document.getElementById('headcover').value.split('%')
		document.getElementById('headcover_pic').src = '/images/products/' + parts[0] + 'A_S.jpg'
	}
}	

// on checkout page this will autofill the billing address with the shipping address values
function autoFillBilling () {
	document.getElementById('billing_address1').value = document.getElementById('address1').value
	document.getElementById('billing_address2').value = document.getElementById('address2').value
	document.getElementById('billing_city').value = document.getElementById('city').value
	document.getElementById('billing_state').value = document.getElementById('state').value
	document.getElementById('billing_zip').value = document.getElementById('zip').value
	if(document.getElementById('country').value != 'US') {
		document.getElementById('billing_state').value = document.getElementById('foreign_state').value
	}
}

// on checkout page this will autofill the billing address with the shipping address values
function autoFillGuestBilling () {
	document.getElementById('cc_name').value = document.getElementById('first_name').value + ' ' + document.getElementById('last_name').value
	document.getElementById('billing_address1').value = document.getElementById('address1').value
	document.getElementById('billing_address2').value = document.getElementById('address2').value
	document.getElementById('billing_city').value = document.getElementById('city').value
	document.getElementById('billing_state').value = document.getElementById('state').value
	document.getElementById('billing_zip').value = document.getElementById('zip').value
	if(document.getElementById('country').value != 'US') {
		document.getElementById('billing_state').value = document.getElementById('foreign_state').value
	}
}


// handles show hide for foreign state input
function toggleForeign($which){
		if(document.getElementById("country").value == 'US'){
			document.getElementById("state").style.display = "block";
			document.getElementById("foreign_state").style.display = "none";
		}else{
			document.getElementById("state").style.display = "none";
			document.getElementById("foreign_state").style.display = "block";
		}
}

