$(document).ready(function () {
	$.fn.idle = function(time) {
      var o = $(this);
      o.queue(function()
      {
         setTimeout(function()
         {
            o.dequeue();
         }, time);
      });
      return this;              //****
	}
	
	$('#wishlistContainer').css({display:'block'});
	$('#ratingUlNS').css({display:'none'});
	$('#ratingUl').css({display:'block'});

	packstation( $('#station') );

	$(".first").find('.subcontent').animate({left:'hide'},0.5);
	$(".first").hover(function () {
		$(this).find('.subcontent').animate({dummy:1}, 300).animate({height:'show'},1.5);	
		},
		function () {
			$(this).find('.subcontent').css({'display':'none'})
			$(this).find('.subcontent').animate({height:'hide'},0.5);
			});
		
		$('a.highslide').each(function() {
			this.onclick = function() {		
				return hs.expand(this);
			};
		});
	
	hs.dimmingOpacity = 0.8;	
	$('a.highslidevideo').each(function() {
		this.onclick = function() {			
			return hs.htmlExpand(this, {align: 'center', objectType: 'swf', width: 600, objectWidth: 600, objectHeight: 400,height: 430,  maincontentText: 'Kein Flashplayer gefunden'})
		};
	});
	
	$('a').each(function() {
		  this.onfocus = function() {
		  this.blur();
		  };
	});
	
	
	$('.item a').each(function() {
		$(this).attr("href","javascript:void(0)");				   
	});					   
    $('.wikiP').css({display:'none'});
    $('#colorTabMwst').css({display:'block'});
	$('#colorTabs a').click(function() {									
	 	 $('#colorTabs a').each(function() {							
					$(this).removeClass('aktivTab');					
						}); 
	  $(this).addClass('aktivTab');
	 if( $('#colorTabs1').attr('class')=='aktivTab'){
		 				$('#colorTabMwst').css({display:'block'});
						$('#colorTabs').removeClass('secondTab');
						$('#colorListC').css({display:'block'});
						$('#helpTab').css({display:'none'});
						}
	if( $('#colorTabs2').attr('class')=='aktivTab'){
		 				$('#colorTabMwst').css({display:'none'});
						$('#colorTabs').addClass('secondTab');
						$('#colorListC').css({display:'none'});
						$('#helpTab').css({display:'block'});
							}
     });
	 
	 //noscript fix
	$('#theInfoText').show();
	$('#theBottom').show();
	$('#wishlistContent').css('height','auto');
	$('#wishlistReset').removeClass('full');

});

function packstation(o) {
    if ( $(o).attr('checked') ) {
        $('#Strasse').css('display', 'none');
        $('#Company').css('display', 'none');
        $('#Packstation').css('display', 'block');
        $('#Postnummer').css('display', 'block');
        
        $('input', $('#Company')).val('');   // no company allowed when using packstation
    } else {
        $('#Strasse').css('display', 'block');
        $('#Company').css('display', 'block');
        $('#Packstation').css( 'display', 'none');
        $('#Postnummer').css( 'display', 'none');
    }
}

function clearError(errorObject){
	var eObject=errorObject.parentNode.parentNode;
	$(eObject).find('.tooltipError').css({'display':'none'});
	}// function end
	function writeError(errorObject){
	var eObject=errorObject;
	if(eObject.value==eObject.defaultValue){
	$(eObject.parentNode.parentNode).find('.tooltipError').css({'display':'block'});
	}
	if(eObject.previousSibling && eObject.previousSibling.previousSibling && eObject.previousSibling.previousSibling.value==eObject.previousSibling.previousSibling.defaultValue){
	$(eObject.parentNode.parentNode).find('.tooltipError').css({'display':'block'});
	}
	if(eObject.nextSibling && eObject.nextSibling.nextSibling && eObject.nextSibling.nextSibling.value==eObject.nextSibling.nextSibling.defaultValue){
	$(eObject.parentNode.parentNode).find('.tooltipError').css({'display':'block'});
	}
	}// function end
	function oneInBasket(basketObject){
	var bObject=basketObject.previousSibling;
	if(bObject && bObject.value==bObject.defaultValue){
	bObject.value='1';
	}
}// function end
function makeStars(n){ // function zur auswahl der bewertungssterne
	var currentWidth=(n*13)+'px';
	$('#current_rate').css({width:''+currentWidth+''});  
}

