//cufon replace
Cufon.replace('.nav, .sans', { 
	fontFamily: 'TheSerifOffice' ,
	hover: true
});
Cufon.replace('.futura', { 
	fontFamily: 'Futura MdCn BT' ,
	hover: true
});

function googlemaps(){
	var myCenter = new google.maps.LatLng(51.75066, 4.10544);
	var myOptions = {
	  zoom: 16,
	  center: myCenter,
	  mapTypeId: google.maps.MapTypeId.ROADMAP,	  
	  mapTypeControl: false,
	  scrollwheel: false
	}
	var myLatlng = new google.maps.LatLng(51.75066, 4.10544);
	var map = new google.maps.Map(document.getElementById("map"), myOptions);
	var image = new google.maps.MarkerImage('images/template/marker-herweijer.png',
		new google.maps.Size(190, 96),
		// The origin for this image is 0,0.
		new google.maps.Point(0,0),
		// The anchor for this image is the base of the flagpole at 0,32.
		new google.maps.Point(72, 90)
	);
	var marker = new google.maps.Marker({
		position: myLatlng, 
		map: map,
		icon: image
	});
}

function shoppingcart(){
	$('.product-item .number .input input').change(function(){
		var nProduct = $(this).parents('.product-item').attr('id').replace('item_','');
		var nAmount = $(this).attr('value');		
		loadShoppingCart('product=' + nProduct + '&updateAmount=' + nAmount);
	});
	$('.product-item .delete').click(function(){
		var nProduct = $(this).parents('.product-item').attr('id').replace('item_','');
		loadShoppingCart('product=' + nProduct + '&updateAmount=0');
	});
	$('.pay-now').click(function(){
		if(!$('input#check').is(':checked')){
			$('#error-check').show();	
		} else {
			$('form#check-voorwaarden').submit();	
		}
	});
}
function loadShoppingCart(p_sData){
	$.ajax({
		type: 'POST',
		url: sDomain+'requests/shoppingcart.req.php',
		data: p_sData,
		success: function(result){
			//result in div stoppen
			$('#ajax').html(result);
			//aantal artikelen updaten in header
			if($('#total-items').length > 0){ var sTotalItems = $('#total-items').text(); } 
			else { var sTotalItems = '0 artikelen'; }
			$('#shopping-cart strong').html(sTotalItems);
			//events opnieuw inladen voor shoppingcart
			shoppingcart();
		}
	});
}

