$(document).ready(function(){
 try {
 /* init prettyPhoto */
     $("a[rel^='prettyPhoto']").prettyPhoto({
      theme: 'light_rounded'
      ,slideshow: false
      ,overlay_gallery: false
      //, show_title: false
     });
	 
 /* init tooltips */
// $(".tooltip").tooltip();
     
 /* init jquery-ui buttons */
     $( ".powermail_submit" ).button({
		text: true
		,icons: {primary:'ui-icon-mail-closed'}
		,label: 'Senden >>'
     });
     $( ".tx-powermail-pi1_confirmation_submit" ).button({
		text: true
		,icons: {primary:'ui-icon-check'}
		,label: 'Angaben abschicken'
     });
     $( ".tx-powermail-pi1_confirmation_back" ).button({
		text: true
		,icons: {primary:'ui-icon-close'}
		,label: 'Zurück'
     });

     $( ".button-refresh" ).button({
       icons: {primary:'ui-icon-refresh'}
     });
     $( ".button-nextstep" ).button({
       icons: {primary:'ui-icon-check'}
     });
     $( ".button-cartstep" ).button({
       icons: {primary:'ui-icon-cart'}
     });
     // ui-icon-arrowreturnthick-1-w
     $( ".button-edit" ).button({
       icons: {primary:'ui-icon-arrowreturnthick-1-w'}
     });
     $( ".button-print" ).button({
       icons: {primary:'ui-icon-print'}
     });
	 
/*     $( ".tx-powermail-pi1_confirmation_submit" ).button({
       icons: {primary:'ui-icon-print'}
     }); */
	 
 /* init jquery rating */
     $('.hover-star').rating({
      focus: function(value, link){
        var tip = $('#hover-test');
        tip[0].data = tip[0].data || tip.html();
        tip.html(link.title || 'value: ' + value);
      },
      blur: function(value, link){
        var tip = $('#hover-test');
        $('#hover-test').html(tip[0].data || '');
      },
      callback: function(value, link){
       $('#ratingvalue').val( '' ) ; // reset content
       $('#ratingvalue').val( value ) ; // set new value, will be "" if value==undefined wich corresponds to the cancel action
      }
     });

	if( $('#iframe_catalog').length > 0 ) {
 		$.prettyPhoto.default_height = 700;
		$.prettyPhoto.open('http://www3.catoya.com/asp/_1158/flash/?iframe=true&width=980&height=785','','');
	}
/* blur/click listener for the quantity field in the product details */
	if( $('#quantity') ) {
		$('#quantity').click(function() {
			if( parseInt(this.value) == 1 ) {
				this.value=''; // remove preset quanity when clicking into the field
			}
		});
		$('#quantity').blur(function() {
			if( ! parseInt(this.value) > 0 ) {
				this.value=1; // reset preset quanity when blur and no quantity 
			}
		});
	}
$('.button-nextstep').click(function(){
 var msg = '<div class="modal-checkout-message"> \
 <div class="modal-checkout-message-image"></div> \
 <div> \
  <h1 class="modal-checkout-message-headline">Bitte Warten</h1> \
  <p class="modal-checkout-message">Ihre Daten werden verarbeitet</p> \
 </div> \
</div>';	 
	$.blockUI({
		overlayCSS:{backgroundColor:'#f00'},
		//message:'&nbsp;',
		message:msg,
		css:{
			border:0,
			backgroundColor:'transparent'
		}
	});
});

 } catch (ErrMsg) {
  alert('Javascript Exception: ' + ErrMsg);
 }
});
