$(document).ready(function(){

	// fancybox
	$('a[href$=.jpg],a[href$=.png],a[href$=.gif]').fancybox({
		'titleShow' : true,
		'titlePosition' : 'over',
		'centerOnScroll' : true,
		'padding' :	5,
		'overlayColor' :'#F1F1ED'
	}); 
	
	$('a.iframe').fancybox({
		'titleShow' : false,
		'width' : '1024',
		'height' : '768',
		'padding' :	5,
		'overlayColor' :'#F1F1ED'
	});
	
	// open links with rel=external in a new window
	$('a[class*=external], ul.downloads li a').click( function() {
		window.open(this.href);
		return false;
	});
	
	// smooth scrolling
	$("a.smoothscroll").click(function() {
		var elementClicked = $(this).attr("href");
		var destination = $(elementClicked).offset().top;
		$("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination-20}, 1000 );
		return false;
	});
	
	// liest den title von Inputfeldern aus und setzt ihn dynamisch als value
	function switchText()
	{
		if ($(this).val() == $(this).attr('title'))
			$(this).val('').removeClass('exampleText');
		else if ($.trim($(this).val()) == '')
			$(this).addClass('exampleText').val($(this).attr('title'));
	}
	
	$('input[type=text][title!=""]').each(function() {
		if ($.trim($(this).val()) == '') $(this).val($(this).attr('title'));
		if ($(this).val() == $(this).attr('title')) $(this).addClass('exampleText');
	}).focus(switchText).blur(switchText);
	
	$('form').submit(function() {
		$(this).find('input[type=text][title!=""]').each(function() {
			if ($(this).val() == $(this).attr('title')) $(this).val('');
		});
	});
	
	// adds table classes
	$('table.productTable tr td:nth-child(1)').addClass('legend');
	
});


	
