var _form;
var _value;
var _radios;
var _checks;
var _discount;
function initPrice() {
	_form = $('#price-form');
	_value = $('#price-val');
	_radios = _form.find('input[type="radio"]');
	_checks = _form.find('input[type="checkbox"]');
	_discount = 0;

	

	_radios.each(function(){
		$(this).click(function(){
			calcPrice();
		});
	});
	
	_checks.each(function(){
		$(this).click(function(){
			//alert('lo');
		
			calcPrice();
		});
	});
	
	
	calcPrice();
}

function calcPrice() {
	var val = 0;
	_discount=0;

	_checks.each(function(){
		//if($(this).is(':checked')) _discount+=parseInt($(this).val());
	})
	val = parseInt(_radios.filter(':checked').val());
	
	if(_checks.filter(':checked').attr('id') == "abo"){
		if(val == 550){
			//alert('abo');
			val = 425; //als radio value = 550;		
		}
		if(val == 750){
			val = 595; //als radio value = 750
		}
	} 
	
	if(_checks.filter(':checked').attr('id') == "org"){
		//alert('abo');
		if(val == 550){
			val = 350 //als radio value = 550;
		}
		if(val == 750){
			val = 545 //als radio value = 750;
		}
	} 
	
	if(parseInt(_radios.filter(':checked').val()) == 265){
		val = 265;
	}
		
	_value.html(val);
}

function initGallery() {
	$('div.G1').galleryScroll({autoSlide: 2500});
}
function marginFix(){
	$('.marginfix').each(function(e){
		newVal = $(this).height()/2;
		newVal = newVal - ($('img:first', this).height()/2);
		$('img:first', this).css({marginTop: newVal});
	});
}
$(document).ready(function(){
	initGallery();
	initPrice();
	marginFix();
});