
/** Truncate BOX */





	  $(document).ready(function(){

		  /** Bei zu langem Beschreibungstext akürzen **/
		  $(".tuncated5em").jTruncate({  
		     length: 100,  
		     minTrail: 50,  
		     moreText: "more",  
		     lessText: "hide",  
		     ellipsisText: " ...(trunceted)"  
		  });
		  
		  $(".truncate_more_link").parent().css("margin-top","0.5em").css("margin-bottom","0.5em").css("text-align","left").css("font-size","100%");
		  
		  /** Scrollbar bei zu vielen Thumbnails **/
		  
		  
		  $(".thumbnails").html("<img src=\"lib/images/arrowr.gif\" alt=\">\"><img src=\"lib/images/arrowl.gif\" alt=\"<\"><div class=\"scrollpanel\">" + $(".thumbnails").html() + "</div>")		  
		  $(".thumbnails > img").each(function(i, elem) {  
			  if (i>1)
				  return;
			  if (i==0) {
				  $(elem).css({float: "right", width: "25px"});
			  	  $(elem).click(function() {
			  		  $(".scrollpanel").scrollTo('+=52px', { axis:'x', duration: 800 });
			  	  });
			  }
			  if (i==1) {		  
				  $(elem).css({float: "left", width: "25px"});
			  	  $(elem).click(function() {
			  		  $(".scrollpanel").scrollTo('-=52px', { axis:'x', duration: 800 });
				  });	
			  }
		  });
		  
		  $(".thumbnails").css("width", "412px");
		  $(".thumbnails > .scrollpanel").css("width", "355px");		  
		  $(".thumbnails > .scrollpanel").css("margin-left", "auto");
		  $(".thumbnails > .scrollpanel").css("margin-right", "auto");
		  $(".thumbnails > .scrollpanel").css("border-left", "3px solid #888");
		  $(".thumbnails > .scrollpanel").css("border", "2px solid #888");
		  $(".thumbnails > .scrollpanel").css("border-right", "3px solid #888");
		  $(".thumbnails > .scrollpanel").css("overflow", "hidden");
		  $(".thumbnails > .scrollpanel").css("white-space", "nowrap");
		  
		  /** Hover-effekt bei Funtkionslinks **/
		  $("div.functions > a").hover(function() {
			  $("img", this).attr("src", "" + $("img", this).attr("src").replace(".gif", "_hover.gif"));
		  }, function() {
			  $("img", this).attr("src", "" + $("img", this).attr("src").replace("_hover.gif", ".gif"));
		  });
		  
		  /** gecrunchte Infoboxen im Artikeldetail **/
		  
		  $(".infobox").each(function(i, elem) {
			  $(elem).before("<p><span hovertip=\"infobox" + i + "\">" + $(elem).find("h4").text() + "</span></p>");
			  $(elem).wrap("<div class=\"hovertip\" id=\"infobox" + i + "\"></div>")
          });
		  
		  if ($("#sKey").val() == '')
			  $("#sKey").val('search for');
		  if ($("#sKey2").val() == '')
			  $("#sKey2").val('search for');
	  });
	  
	    /** Crunching von tabellen **/
	    
      
	    $(document).ready(function() {
	      $("table.crunched").each(function(index, elem) {
	        $("tbody", elem).hide();
	        $("thead > tr > th", elem).prepend("<span style='cursor: pointer'>+</span> ")
	        $("thead > tr > th", elem).css("cursor", "pointer");
	        $("thead > tr > th", elem).hover(function () { 
	        	$(this).css("background", "#800 url(\"lib/images/red_gloss.gif\") repeat-x center");
	        }, function() { 
	        	$(this).css("background", "#000 url(\"lib/images/black_gloss.gif\") repeat-x center"); 
	        });
	        $("thead > tr > th", elem).toggle(function() {
	          $("tbody", elem).show();
	          $("span", this).text("-");   
	          $(this).css("border", "none");          
	        },
	        function() {
	          $("tbody", elem).hide();
	          $("span", this).text("+");
	        });

	        if ($(elem).hasClass("open")) {
	          $("thead > tr > th", elem).click();
	        }
	      });


	    });
	    
	    
	    // Tooltips / Thickboxen in eigenen Thread legen
	    $(document).ready(function() {
	      window.setTimeout(hovertipInit, 1);
	    });
      
      /** Carussels */
      $(document).ready(function() {
          $("#carousel1").jcarousel({
            scroll: 1
          });
          $("#carousel2").jcarousel({
            scroll: 1
          });
      });
      
    /* loggen der Fenstergröße und der Bildschirmauflösung  
     
    
    $(document).ready(function() {
      fensterbreite = $(window).width();
      fensterhoehe =  $(window).height();         
        $("#trackingpixel").attr("src", "tracking.jsp?resolutionWidth="+fensterbreite+"&resolutionHeight="+fensterhoehe+"&screenWidth="+screen.width+"&screenHeight="+screen.height);     
    }); */ 
       
          $(document).ready(function() {
            
             changeAction = function() {
                var maxlength = "1000"; //die maximale Zeichenlänge

                var source = this;
                
                // Aktuelle Länge
                var textLength=source.value.length;
                if (textLength == 1 && source.value.substring(0, 1) == " ")
                {
                  source.value = "";
                  textLength = 0;
                }
                
                if (textLength > maxlength)
                {
                  source.value =source.value.substring(0, maxlength);
                  charsLeft = 0;
                }
                else
                {
                  charsLeft = maxlength - textLength;
                }                    
                
               $("#length").text("noch " + charsLeft + " Zeichen frei");   
            }
            
            $("#length").text("noch 1000 Zeichen frei");
           $("#orderremark").keydown(changeAction);
        });
	
