(function($){
	$(function(){
		if ($('blockquote.diskografie').length < 1) { // Keinen Scroller bei der Discogfrafie > Problem mit SWFObjectt!!!
			$('#pageContent').jScrollPane({
				showArrows: true
			});
		}
	});
})(jQuery);

function crossDomId(x) {
	if(document.all && !document.getElementById){
		return document.all.x;
	}
	else{
		return document.getElementById(x);
	}
}

// calculate price
function calculatePrice(field,out) {

  if(parseInt(field.value) >= 1 && parseInt(field.value) <= 3) { 
	
		var price = field.value * 15.99;
		var versk =  1.45 + 0.70;
		var totalPrice = price + versk;
	
		crossDomId(out).firstChild.nodeValue =  kaufm(price)  + ' € + ' + kaufm(versk) + ' € Versand = ' + kaufm(totalPrice) + ' € inkl. 19% MwSt.';
		crossDomId('Gesamtpreis').value = kaufm(price)  + ' € + ' + kaufm(versk) + ' € Versand = ' + kaufm(totalPrice) + ' € inkl. 19% MwSt.'; 
	
  }
  else{
	
		crossDomId(out).firstChild.nodeValue = 'Preis: --,- €';
		crossDomId('Gesamtpreis').value = 'Preis: --,- €'; 
  }
}

function kaufm(x) {

  var k = (Math.round(x * 100) / 100).toString();
  k += (k.indexOf('.') == -1)? '.00' : '00';
  var p = k.indexOf('.'), m = k.indexOf('-.');
  var f = (p == 0 || m == 0)? '0,' : ',';
  return k.substring(0, p) + f + k.substring(p+1, p+3);
}
