/**
 **************************************************
 * Javascript USERFUNCTIONS
 * userfunctions.js
 *
 * @author: HDNET GmbH & Co. KG
 * @version: 1.0
 * @updated: 2010-12-10 (MS)
 **************************************************
**/




/**
 **************************************************
 GLOBAL DEFINITIONS
 *
 * @description: global domready function for all functions
 **************************************************
**/
jQuery(document).ready(function($) {

	/**
	 **************************************************
	 PRODUCT RONDELL
	 *
	 **************************************************
	**/
	var $teaser = $('#teaser'),
		$teaserRondell = $teaser.find('.rondell'),
		$teaserMask = $teaser.find('.mask');
	if($teaser.find('ul.products').children().size() > 0) {
		var teaserApi = $teaserRondell
			.scrollable({
				circular: true
			})
			.autoscroll({
				autoplay: true,
				autopause: true,
				interval: 8000
			})
			.data('scrollable');

		/* delegate events through mask */
		$teaserMask.bind('mouseenter mouseleave mouseout mouseover', function(event) {
			$teaserRondell.trigger(event.type);
		});

		$teaserMask.click(function() {
			location.href = teaserApi.getItems().eq(teaserApi.getIndex()).find('> a').attr('href');
		});
	} else {
		$teaser.remove();
	}

	/**
	 **************************************************
	 PRODUCT LISTING ACTIONS-COULUMN HEIGHT
	 *
	 **************************************************
	**/
	jQuery('.products-list li.item .actions').each(function(i, item) {
		var $rCol = jQuery(item),
			$lCol = $rCol.parents('li.item'),
			pxHeight = Math.max($rCol.outerHeight(), $lCol.outerHeight()) + 'px';
		$rCol.add($lCol).css('height',pxHeight);
	});

/* *** GLOBAL domready end *** */
});
