       var aktiv = 0;
		    
       function fade_motiv(base, id) {
          if(id !== aktiv) {
              if(aktiv > 0) {
                  $('#motiv_'+base+'_'+aktiv).hide();
                  $('#artikel_'+base+'_'+aktiv).show();
                  aktiv = 0;
              }    
              
              if(id > 0) {
                  aktiv = id;
                  $('#motiv_'+base+'_'+aktiv).show();
                  $('#artikel_'+base+'_'+aktiv).hide();            
              }
          }
       }
       
        var aktivContainer = 0;
       
      function fade_container(base, id) {
          if(id !== aktivContainer) {
              if(aktivContainer > 0) {
                  $('#container1_'+base+'_'+aktivContainer).hide();
                  $('#container2_'+base+'_'+aktivContainer).show();
                  aktivContainer = 0;
              }    
              
              if(id > 0) {
                  aktivContainer = id;
                  $('#container1_'+base+'_'+aktivContainer).show();
                  $('#container2_'+base+'_'+aktivContainer).hide();            
              }
          }
       }
       
      function browsercheck() {
	
	
		  var browsercheck = false;
		    var browserName = navigator.appName;
		    var browserVersion = parseInt(navigator.appVersion);
		    
		    
		    var hasSVGSupport = false;
                    var useVBMethod = false;
		    
		    /*
		    alert(navigator.appVersion);
		    
		    if(navigator.appName.indexOf('Firefox') > -1) {
			alert("Firefox");    
		    }
		    else if (navigator.appVersion.indexOf('Chrome') > -1) {
			alert("Chrome");
		    }
		    else if (navigator.appVersion.indexOf('Safari') > -1) {
			alert("Safari");
		    }
		    else if (navigator.appName.indexOf('Opera') > -1) {
			alert("Opera");
		    }
		    else if (navigator.appName.indexOf('Microsoft') > -1) {
			alert("Internet Explorer");    
		    }
		    */

			    
		    
		    if (browserName == "Netscape" && browserVersion == 5) {
			browsercheck = true;
		    }
		    else if (browserName == "Microsoft Internet Explorer" && browserVersion == 5 && navigator.appVersion.indexOf("MSIE 9.0") != -1) {
			browsercheck = true;
		    }
		    
		  
                  
                    if (navigator.mimeTypes.length == 0) {
                      //  useVBMethod = true;
                         
                    } else {
                        if (navigator.mimeTypes["image/svg-xml"] != null) {
                            hasSVGSupport = true;
                        }
                    }
		    
		    if(browsercheck == true) {
			hasSVGSupport = true;
		    }
		    else {
			hasSVGSupport = false;
		    }
	
	
	
		     return hasSVGSupport;
	
	
      }
       
       
	 function openMiniNav() {
	    
	       if (document.getElementById("openMiniNav") != null) {
		  
		  if(document.getElementById("openMiniNav").style.display == "block") {
		     document.getElementById("openMiniNav").style.display = "none";
		   
		  }
		  else if(document.getElementById("openMiniNav").style.display == "none") {
		      document.getElementById("openMiniNav").style.display = "block";
		     
		  }
	       }
	    
	 }
      
       
       function changeBackgroundcolor(color, base, id ) {
	     
	      if (document.getElementById("container_"+base+"_"+id) != null) {
		     document.getElementById("container_"+base+"_"+id).style.backgroundColor = color;
	      }
       }

 function toggleBlock(bid, pic) {
        bStatus = (document.getElementById(bid).style.display == 'none') ? 'block' : 'none';
        document.getElementById(bid).style.display = bStatus;
    
        if(pic == 'plusminus') { pic1 = 'gfx/icons/plus.gif'; pic2 = 'gfx/icons/minus.gif'}
        if(pic == 'updown') { pic1 = 'gfx/icons/up.gif'; pic2 = 'gfx/icons/down.gif'}
    
        if ((!bStatus) || (bStatus=='none')) {document.images['icon_'+bid].src=pic1; }
        else { document.images['icon_'+bid].src=pic2; }
    }
    
    function togglepic(container) {
        var status = (document.getElementById(container).style.display == 'none') ? 'block' : 'none';
        //document.getElementById(bid).style.display = bStatus;
    
        pic1 = 'gfx/icons/up.gif';
        pic2 = 'gfx/icons/down.gif';
    
        if ((!status) || (status=='none')) {document.images['icon_'+container].src=pic1; }
        else { document.images['icon_'+container].src=pic2; }
    }
    
    function switchtext(text) {
    
        document.getElementById("content_navtext").innerHTML = text;
                      
    
    }
    
   
      function is_array(input){
	return typeof(input)=='object'&&(input instanceof Array);
      }
   
    
    
   function /*out: String*/ number_format( /* in: float   */ number,
                                               /* in: integer */ laenge,
                                               /* in: String  */ sep,
                                               /* in: String  */ th_sep ) {
       
         number = Math.round( number * Math.pow(10, laenge) ) / Math.pow(10, laenge);
         str_number = number+"";
         arr_int = str_number.split(".");
         if(!arr_int[0]) arr_int[0] = "0";
         if(!arr_int[1]) arr_int[1] = "";
         if(arr_int[1].length < laenge){
           nachkomma = arr_int[1];
           for(i=arr_int[1].length+1; i <= laenge; i++){  nachkomma += "0";  }
           arr_int[1] = nachkomma;
         }
         if(th_sep != "" && arr_int[0].length > 3){
           Begriff = arr_int[0];
           arr_int[0] = "";
           for(j = 3; j < Begriff.length ; j+=3){
             Extrakt = Begriff.slice(Begriff.length - j, Begriff.length - j + 3);
             arr_int[0] = th_sep + Extrakt +  arr_int[0] + "";
           }
           str_first = Begriff.substr(0, (Begriff.length % 3 == 0)?3:(Begriff.length % 3));
           arr_int[0] = str_first + arr_int[0];
         }
         return arr_int[0]+sep+arr_int[1];
    }
    
     function createwaitingbutton(id) {
      
	
	 if(document.getElementById(id)) {
	      
	      
	      document.getElementById(id).value = "bitte warten !";
	      document.getElementById(id).innerHTML = "bitte warten !";
	      document.getElementById(id).setAttribute("disabled", "disabled"); 
	      document.getElementById(id).setAttribute("class", "waiting_button"); 
	      document.getElementById(id).style.curser = "normal"; 
	   
	 }
	 
      }
      
      function showwaiting(id) {
	 
	 if(document.getElementById(id)) {
	    
	       /* waitingOverlay über Div Container */
	   
	       // document.getElementById(id).innerHTML = "";
	       var width = document.getElementById(id).offsetWidth;
	       var height = document.getElementById(id).offsetHeight;
	      
	       width = width - 15;
	       
	       var div = document.createElement("div");
	       div.setAttribute("id", "div_overlay");
	       div.style.width = ""+width+"px";
	       div.style.height = ""+height+"px";
	       div.style.styleFloat = "left"; // IE
	       div.style.cssFloat = "left"; // Gecko
	       div.style.backgroundColor = "#FFFFFF";
	       div.style.filter = "alpha(opacity=55)"; /* IE's opacity*/
	       div.style.opacity = "0.55";
	       div.style.color  = "#000000";
	       div.style.border = "1px solid #D1D3D4";
	    
	       div.style.position = "relative";
	       div.style.top = "-"+height+"px";
	       div.style.zIndex = "5";
	       
	       var img = document.createElement("img");
                    
	       img.setAttribute("src", "gfx/icons/ajax-loader.gif");
	       //img.setAttribute("alt", "loading");
	       img.style.styleFloat = "left"; // IE
	       img.style.cssFloat = "left"; // Gecko
	       img.style.display = "block";
	       img.style.position = "relative";
	       img.style.margin = ""+(height/2)+"px "+(width/2)+"px";
	       div.appendChild(img);
	       
	       document.getElementById(id).appendChild(div);
   
	       document.getElementById(id).style.height = ""+height+"px";
	       
	    
	    
	    
	    
	    
	      
	 
	 }
      }

   var NoSVGFrame = {
       
         
         show : function()
         {
               document.getElementById("SVGInfo").setAttribute("class", "errorbox");
               document.getElementById("SVGInfo").setAttribute("className", "errorbox");
              
               document.getElementById("SVGInfo").innerHTML = "";
               document.getElementById("SVGInfo").style.margin = "50px";
               
       
            
                  infomessage = "<h3>Fehlendes Browserplugin !</h3>";
                  infomessage += "<img src=\"gfx/content/nosvgsupport.png\" style=\"float:right; padding:0px; width:500px;\" alt=\"nosvgsupport\">";
                  infomessage += "<img src=\"gfx/icons/alert.png\" style=\"float:left; padding:10px; width:128px;\" alt=\"Achtung\">";
                  infomessage += "leider funktioniert die Seite nicht ohne die Möglichkeit Vektorgrafiken <a href=\"http://de.wikipedia.org/wiki/Vektorgrafik\" target=\"_blank\">(Infos dazu)</a> darzustellen.<br />";
                  infomessage += "Bis auf den Internet Explorer ist dies bei allen aktuellen Browsern standard - bei dem IE muss ein zusätzliches Plugin von Adobe namens SVG Viewer <a href=\"http://www.adobe.com/svg/viewer/install/\" target=\"_blank\">(Infos dazu)</a> installiert werden damit die Seite korrekt dargestellt wird (siehe rechtes Bild).<br /><br />";
                  infomessage += "<ul>";
                  infomessage += "<li><b><p style=\"font-size:16px; color:white;\">Möglichkeit a:) Installiere dir den kostenfreien Browser Firefox 3 von Mozilla und surfe daraufhin schneller und sicherer durchs Internet - <a href=\"http://www.mozilla-europe.org/de/firefox/\" target=\"_blank\">(klicke hier)</a></p></b></li>";
                  infomessage += "<li><b><p style=\"font-size:16px; color:white;\">Möglichkeit b:) bleibe dem Internet Explorer treu und installiere dir den SVG Viewer von Adobe - <a href=\"http://download.adobe.com/pub/adobe/magic/svgviewer/win/3.x/3.03/de/SVGView.exe\" target=\"_blank\">(klicke hier)</a></p></b></li>";
                  infomessage += "</ul>";
                  infomessage += "Dies ist natürlich ein einmaliger Vorgang, nach dem auch viele weitere Webseiten und Bilder z.b. auf Wikipedia korrekt angezeigt werden können.<br />";
                  infomessage += "Lade nach dem Update diese Seite hier erneut. Danke für die Mühen - wir garantieren, es lohnt sich.<br /><br />dein Getshirts-Team<br />";
                  
                  
                  document.getElementById("SVGInfo").innerHTML = infomessage;
            
              
         }
      };

     
      function validateEMail(emailStr) {
	    
	
		// Test country oder TLD.
		//  1 für testen, 0 nicht testen
		var checkTLD=1;
		
		// TLDs Liste
		var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
		
		// user@domain format
		var emailPat=/^(.+)@(.+)$/;
		
		// Liste zeichen ( ) < > @ , ; : \ " . [ ]
		var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
		var validChars="\[^\\s" + specialChars + "\]";
		
		// in Anführungszeichen? (dann sind special charakters erlaubt)
		var quotedUser="(\"[^\"]*\")";
		
		// domains mit IP addressen
		
		var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
		
		var atom=validChars + '+';
		var word="(" + atom + "|" + quotedUser + ")";
		var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
		var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
		var matchArray=emailStr.match(emailPat);
		
		if (matchArray==null) {
		
		// test Anzahl der @
		
		alert("Email-addresse incorrect (prüfen Sie @ und Punkte)");
		return false;
		}
		var user=matchArray[1];
		var domain=matchArray[2];
		
		// test gültige ASCII characters (0-127).
		
		for (i=0; i<user.length; i++) {
		if (user.charCodeAt(i)>127) {
		alert("Username hat ungültige Zeichen !");
		return false;
		   }
		}
		for (i=0; i<domain.length; i++) {
		if (domain.charCodeAt(i)>127) {
		alert("Domainname hat ungültige Zeichen !");
		return false;
		   }
		}
		
		
		if (user.match(userPat)==null) {
		
		// user nicht OK
		
		alert("Username ist ungültig !");
		return false;
		}
		
		// IP addresse OK ?
		
		var IPArray=domain.match(ipDomainPat);
		if (IPArray!=null) {
		
		// es handelt sich um eine IP-Adresse
		
		for (var i=1;i<=4;i++) {
		if (IPArray[i]>255) {
		alert("Empfänger IP-Adresse is ungültig !");
		return false;
		   }
		}
		return true;
		}
		
		// Domain ist ein "symbolic name",  gültig ?
		
		var atomPat=new RegExp("^" + atom + "$");
		var domArr=domain.split(".");
		var len=domArr.length;
		for (i=0;i<len;i++) {
		if (domArr[i].search(atomPat)==-1) {
		alert("Domainname ist ungültig !");
		return false;
		   }
		}
		
		/*
		domain name valid, testen bekannte top-level domain
		hostname vorangestellt ?
		*/
		
		if (checkTLD && domArr[domArr.length-1].length!=2 &&
		domArr[domArr.length-1].search(knownDomsPat)==-1) {
		alert("Email Adresse muss mit bekannter Domain (TLD) oder 2 Zeichen enden !");
		return false;
		}
		
		// hostname vorangestellt ?
		
		if (len<2) {
		alert("hostname fehlt!");
		return false;
		}
		
		// hier angekommen ist alles OK
		return true;
		

	}
	
	function saveMailSession(go) {
	 
	       
	       var mail = document.getElementById("frm_mail").value;
	
	       if(validateEMail(mail) == true) {
                             
			json_url = 'ajax.php?func=saveMail&mail='+mail;
             
			if(json_url) {
			   $.ajax({
			      url: json_url,
			      type: 'GET',
			      dataType: 'json',
			      timeout: 10000,
			      global: 'false',
			      error: function(){
				 alert('Fehler.');
			      },
			      success: function() { 
				 setTimeout('tb_remove()',100);
				 if(go == 'warenkorb') {
				    createwaitingbutton('submitbutton1');
				    showwaiting('page_margins');
				    document.form_bestellung.action = 'index.php?page=warenkorb';
				    document.form_bestellung.submit();
				 }
				 
				 
			      }
			   
			    });
			}     
			     
			     
                             return true;
	       }
	       else {
		       return false;
	       }
	 
	}
       

/* ####################################################################################################### */
/* ####################################################################################################### */
/* ####################################################################################################### */

/*
 * jQuery Impromptu
 * By: Trent Richardson [http://trentrichardson.com]
 * Version 1.2
 * Last Modified: 11/21/2007
 * 
 * Copyright 2007 Trent Richardson
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
jQuery.extend({	
	ImpromptuDefaults: { prefix:'jqi', buttons:{ Ok:true }, loaded:function(){}, submit:function(){return true;}, callback:function(){}, container:'body', opacity:0.6, overlayspeed:'slow', promptspeed:'fast', show:'show'},
	SetImpromptuDefaults: function(o){ 
		jQuery.ImpromptuDefaults = jQuery.extend({},jQuery.ImpromptuDefaults,o);
	},
	prompt: function(m,o){
		o = jQuery.extend({},jQuery.ImpromptuDefaults,o);
		
		var ie6 = (jQuery.browser.msie && jQuery.browser.version < 7);	
		var b = (ie6)? jQuery(document.body):jQuery(o.container);	
		var fade = '<div class="'+ o.prefix +'fade" id="'+ o.prefix +'fade"></div>';
		if((jQuery.browser.msie && jQuery('object, applet').length > 0) || ie6)
			fade = '<iframe src="" class="'+ o.prefix +'fade" id="'+ o.prefix +'fade"></iframe>';
		var msgbox = '<div class="'+ o.prefix +'" id="'+ o.prefix +'"><div class="'+ o.prefix +'container"><div class="'+ o.prefix +'message">'+ m +'</div><div class="'+ o.prefix +'buttons" id="'+ o.prefix +'buttons">';
		jQuery.each(o.buttons,function(k,v){ msgbox += '<button name="'+ o.prefix +'button'+ k +'" id="'+ o.prefix +'button'+ k +'" value="'+ v +'">'+ k +'</button>'}) ;
		msgbox += '</div></div></div>';
		
		var jqi = b.prepend(msgbox).children('#'+ o.prefix);
		var jqif = b.prepend(fade).children('#'+ o.prefix +'fade');
		
		//ie6 calculation functions
		var getfoffset = function(){ return (document.documentElement.scrollTop || document.body.scrollTop) + 'px'; };
		var getjoffset = function(){ return (document.documentElement.scrollTop || document.body.scrollTop) + Math.round(15 * (document.documentElement.offsetHeight || document.body.clientHeight) / 100) + 'px'; };
		var ie6scroll = function(){ jqif.css({ top: getfoffset() }); jqi.css({ top: getjoffset() }); };
		
		jqif.css({ position: "absolute", height: (ie6)? "100%":b.height(), width: "100%", top: (ie6)? getfoffset():0, left: 0, right: 0, bottom: 0, zIndex: 998, display: "none", opacity: o.opacity });
		jqi.css({ position: (ie6)? "absolute" : "fixed", top: (ie6)? getjoffset():"30%", left: "50%", display: "none", zIndex: 999, marginLeft: ((((jqi.css("paddingLeft").split("px")[0]*1) + jqi.width())/2)*-1) });
			
		jQuery('#'+ o.prefix +'buttons').children('button').click(function(){ 
			var msg = jqi.children('.'+ o.prefix +'container').children('.'+ o.prefix +'message');
			var clicked = o.buttons[jQuery(this).text()];	
			if(o.submit(clicked,msg)){		
				jqi.remove(); 
				if(ie6)jQuery(window).unbind('scroll',ie6scroll);//ie6, remove the scroll event
				jqif.fadeOut(o.overlayspeed,function(){
					jqif.remove();
					o.callback(clicked,msg);
				});
			}
		});
				
		if(ie6) jQuery(window).scroll(ie6scroll);//ie6, add a scroll event to fix position:fixed
		jqif.fadeIn(o.overlayspeed);
		jqi[o.show](o.promptspeed,o.loaded);
		return jqi;
	}	
});

    

    
