//jQuery.noConflict();

jQuery(document).ready(function($){



// $(document).ready(function(){

    $('form').each(function() {
        $('input').keypress(function(e) {
            // Enter pressed?
            if(e.which == 10 || e.which == 13) {
                this.form.submit();
            }
        });

 //       $('input[type=submit]').hide();
    });



	$('#hotel-objektausstattung #newslink').click( function(){ return false; } );
	
	// product overview
	$('#overview-switch').toggle( function(){
		$('#overview-matrix').toggle();
		$('#overview-table').toggle();
	}, function(){
		$('#overview-matrix').toggle();
		$('#overview-table').toggle();
	});

	// searchbox
	$('#srch_fld').blur(function(){
		if($('#srch_fld').val() == '') $('#srch_fld').val('Stichwortsuche');
		$('#srch_fld').css("color",'#aaa');
	});
	$('#srch_fld').focus(function(){
		if($('#srch_fld').val() == 'Stichwortsuche') $('#srch_fld').val('');
		$('#srch_fld').css("color",'#444');
	});
	$('#srch_fld').blur();
	
	$('#sbox #zoom a').click( function(){
		$('#sbox').submit();
		return false;
	});

	// zebra table
	$('div.content tbody tr:nth-child(odd)').addClass('odd');
	$('#overview-table tbody tr:nth-child(odd)').addClass('odd');
	
	// round the corner
	$('.b160').corner('5px');
	
	$('.module-skip a').toggle( function(){
		$('.module-content').hide('slow');
		$('.module-text').html('Nach Hersteller sortieren');
	}, function(){
		$('.module-content').show('fast');
		$('.module-text').html('Hersteller verbergen');
	});
	
	// slideshow
	$('#preview').cycle({ 
		fx: 'fade', 
		speed: 2000, 
		timeout: 4000,
		pager:'#crosslinks',
		pause: 1,
		pagerAnchorBuilder: function(idx, slide) { 
			return '<li><a href="#"><img src="'+ slide.src +'" width="50" height="50" /></a></li>'; 
		}
	});
	$('#preview528').cycle({ 
		fx: 'fade', 
		speed: 2000, 
		timeout: 4000, 
		pause: 1 
	});	
		
	// artikel tooltip
	$('.artikel img').tooltip({
		delay: 100,
		track: true,
		showURL: false,
		showBody: ' - '
	});
	
	// social
	$('.social a').tooltip({
		delay: 100,
		track: true,
		showURL: false,
		showBody: ' - '
	});

	// filter brand
	$('.selector').click( function(){
		$('.artikel').hide();
		$(this.title).fadeIn('fast');
		$('.selector').removeClass('active');
		$('.selector_price').removeClass('active');
		$(this).addClass('active');
		return false;
	});

	$('.selector_reset').click( function(){
		$('.artikel').fadeIn('fast');
		$('.selector').removeClass('active');
		$('.selector_price').removeClass('active');
		return false;
	});

	$('.selector_price').click( function(){
		$('.artikel').hide();
		$(this.title).fadeIn('fast');
		$('.selector').removeClass('active');
		$('.selector_price').removeClass('active');
		$(this).addClass('active');
		return false;
	});
	
	// Rating
	$('#rating_visual').ratings(5).bind('ratingchanged', function(event, data) {
		$('#rating_value').val(data.rating);
		$('#rating_text').text(data.rating);
	});
	

});


