if (!(/iPhone|iPod|Android/.test(navigator.userAgent))) {
	$(document).ready(function() {
		// Generic styles 
		$('a.ajax').colorbox({
			opacity: 1,
			fixed: (!(/iPad/.test(navigator.userAgent)) ? true : false),
			maxHeight: '80%',
			title: function() {
				if ($(this).attr('title') != '') {
					return $(this).attr('title')
				} else if ($('img', this).attr('alt') != '') {
					return $('img', this).attr('alt')
				}
			},
			onOpen: function() {
					$('#cboxOverlay').height($(document).height());
			}
		});
		
		// Slideshows
		$('a.ajax.slideshow').colorbox({
			slideshow:      true,
			slideshowSpeed:	5500
		});
		
		// Thumbstrip
		if (!(/iPad/.test(navigator.userAgent))) {
			$('a.ajax.thumbstrip').colorbox({
				onOpen: function() {
					$('#cboxOverlay')
						.height($(document).height())
						.prepend('<div id="cboxThumbstrip"><ul /></div>');
					
					// related was added as custom function
					$.colorbox.related().find('img').each(function() {
						$('<li><span class="cboxThumb" /><span class="cboxMarker" /></li>').appendTo('#cboxThumbstrip>ul');
						
						// either min or max is possible: max circumscribes the rectangle, min inscribes the rectangle 
						ratio  = Math.max(
							$('#cboxThumbstrip>ul>li>span').width()  / $(this).attr('width'),
							$('#cboxThumbstrip>ul>li>span').height() / $(this).attr('height')
						);
					
						$('<img />')
							.attr('src',    $(this).attr('src'   ))
							.attr('alt',    $(this).attr('alt'   ))
							.attr('title',  $(this).attr('title' ))
							.attr('width', 	ratio*$(this).attr('width'))
							.attr('height', ratio*$(this).attr('height'))
							.appendTo('#cboxThumbstrip li:last-child .cboxThumb');
					});
					

					
					$('#cboxThumbstrip>ul>li').bind(
						'click',
						function(event) {
							event.stopPropagation();
							// set index was added as custom function
							$.colorbox.setindex($(this).index());
						}
					);
				},
				onComplete: function() {	
					// set current class to according thumbstrip item
					// index-Method was edded as custom function
					$('#cboxThumbstrip>ul>li').removeClass('cur');
					$('#cboxThumbstrip>ul>li:eq(' + $.colorbox.index() + ')').addClass('cur');
				},
				onClosed: function() {
					// destroy the thumbstrip since it is dependet on the rel attribute and needs to be recreated
					$('#cboxThumbstrip').remove();
				}
			});
		}
		
		// iframe
		$('a.iframe').colorbox({
			iframe: true,
			innerWidth: '960px',
			innerHeight: '640px'
		});
	});
}
