$(document).ready(function() {
	
	/***
	 * Open Product Demo and 360° View in Colorbox iFrame layer 
	 */
	try {
		if ($('a.cbox_productDemo').length > 0 || $('a.cbox_productView360').length > 0)
		{
			$('a.cbox_productDemo, a.cbox_productView360').colorbox({
				innerWidth: function() {
					var href = $(this).attr('href').split('?');
					var query = href[1];
					var paramPairs = query.split('&');
					for (pair in paramPairs)
					{
						keyValue = paramPairs[pair].split('=');
						if (keyValue[0] == 'width')
						{
							return keyValue[1]
						}
					} 
				},
				innerHeight: function() {
					var href = $(this).attr('href').split('?');
					var query = href[1];
					var paramPairs = query.split('&');
					for (pair in paramPairs)
					{
						keyValue = paramPairs[pair].split('=');
						if (keyValue[0] == 'height')
						{
							return keyValue[1]
						}
					} 
				},
		  	iframe: true
		  });
		}
  }
  catch(e)
  {
  }

	/***
	 * Open Product Gallery View in Colorbox iFrame layer 
	 */
	try {
		if ($('a.cbox_productGallery').length > 0)
		{
			$('a.cbox_productGallery').colorbox({
				innerHeight: 664,
				innerWidth: 960,
				inline: true,
				href: '#PE_camera_gallery',
				onComplete: function() {
					$('#PE_camera_gallery').fadeIn();
				},
				onCleanup: function() {
					$('#PE_camera_gallery').fadeOut('fast');
				}
			});
		}
  }
  catch(e)
  {
  }

		

	/***
	 * Awards: jCarouselLite
	 */	
	try {
		if ( $('#PE_product_award_ticker ul').children().length > 6 )
		{
			$('#PE_product_award_ticker').jCarouselLite({
		    auto: 2000,
		    speed: 1000,
		    visible: 6
	   	});
		}
  }
  catch(e)
  {
  }
	
	
});

