function mycarousel_initCallback(carousel)
{

    // Hier kann ich das autoscrolling deaktivieren, nach einem klick auf vor oder zur�ck, f�r diesen fall eine 0 hinter auto in die klammern
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto();
    });

    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto();
    });

    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};

jQuery(document).ready(function() {
	jQuery('#mycarousel').jcarousel({
        auto: 3,
        scroll:1,
        wrap: 'last',
        initCallback: mycarousel_initCallback
    });
	
	jQuery(".videoLink").fancybox({
	    'padding'           : 10,
	    'overlayColor'		: '#ff6a00',
	    'overlayOpacity'	: 0.8,
        'autoScale'     	: false,
        'width'				: '546px',
        'swf'				: {'allowfullscreen': true},
		'height'			: '410px',
        'transitionIn'		: 'none',
		'transitionOut'		: 'none'
	});

	
	jQuery('.mycarouseldiv').jcarousel({
        auto: 3,
        scroll:1,
        wrap: 'last',
        initCallback: mycarousel_initCallback
    });
	
});

jQuery(function(){
	
	/**
	 * Link Zoom Icon
	 */
	jQuery('.zoomicon').click(function(){
		jQuery('.tx-multicatalog-pi1-single .csc-textpic-imagewrap a').click();
	});
	
	/**
	 * Hide all pictures but the first
	 */
	jQuery('.tx-multicatalog-pi1-single .csc-textpic-imagerow:not(.csc-textpic-imagerow:first)').hide();
	
	/**
	 * Wrap cboxes for doing some CSS
	 */
	jQuery('.cbox').each(function(){
		jQuery(this).wrap('<div class="cbox-wrap"></div>').find('.csc-header h1').parent().insertBefore(this);
		jQuery(this).find('h1:first').insertBefore(this);
	});
	
	/**
	 * Backlink
	 */
	jQuery('#site_backlink').click(function(){
		history.back();
		return false;
	});

	
});

jQuery(function() {
	jQuery("#mailform").validate({
		errorElement: "div",
		errorClass: "formElementError",
		errorPlacement: function(error, element) {
			if(!(jQuery.browser == 'msie' && jQuery.browser.version.substr(0,1)=='6')) {
				error.insertBefore(element.parent("div").find("label"));
			}
		},
  		rules: {
			"formhandler[company]": "required",
			"formhandler[lastname]": "required",
			"formhandler[street]": "required",
			"formhandler[strnumber]": "required",
			"formhandler[zipcode]": {
				required: true,
				minlength: 4
			},
			"formhandler[city]": "required",
			"formhandler[email]": {
				required: true,
				email: true
			}
		},
		messages: {
			"formhandler[company]": "Erforderliche Angabe",
			"formhandler[lastname]": "Erforderliche Angabe",
			"formhandler[street]": "Erforderliche Angabe",
			"formhandler[strnumber]": "Erforderliche Angabe",
			"formhandler[zipcode]": {
				"required": "Erforderliche Angabe",
				"minlength": "Diese PLZ ist zu kurz"
			},
			"formhandler[city]": "Erforderliche Angabe",
			"formhandler[email]": {
				"required": "Erforderliche Angabe",
				"email": "Keine gültige E-Mail-Adresse"
			}	
		}
	});
});
