////////////////////////////////////////////////////////////////
//
// Beschreibung: Browsererkennung
//
////////////////////////////////////////////////////////////////

var ns  = (document.layers) ? 1 : 0;
var ie  = (document.all) ? 1 : 0;
var dom = (document.getElementById) ? 1 : 0;
var mac = (navigator.platform.indexOf("Mac") != -1) ? 1 : 0;
var gecko     = (navigator.userAgent.indexOf("Gecko") != -1) ? 1 : 0;
var geckoVers = parseFloat(navigator.userAgent.replace(/.*rv:(\d+\.\d+).*/, '$1'));
var ieVers    = navigator.appVersion.substring(navigator.appVersion.lastIndexOf("MSIE") + 4,navigator.appVersion.lastIndexOf("MSIE") + 8);


function detectBrowser(){
  var userAgent = navigator.userAgent.toLowerCase();
  if (userAgent.indexOf("safari") != -1){
    var css = '<link rel="stylesheet" type="text/css" href="/arcguide/wGlobal/layout/styles/safari.css"/>';
    jQuery("head").append(css);
  }
  
}
function changeFormContent(berufsgruppe, typ){
  typValue = typ;
  bgValue = berufsgruppe;
  if(bgValue == ''){
    document.getElementById('berufsgruppe').className = 'wglSelectM wglSelectError';
  }
  else{
    var template = '';
    switch(bgValue){
      case '1244017409215': template = 'energieberater'
                            break;
      case '1244017448371': template = 'fotograf'
                            break;
      case '1244017442074': template = 'lichtplaner'
                            break;
      case '1244017433090': template = 'pr'
                            break;
      case '1244017418981': template = 'visualisierung'
                            break;
      default: template = 'architekt'
    }
    template = "profil_" + template;
    location.href = "/arcguide/profil-anlegen.php?overlayProfil=" + template + '&berufsgruppe=' + bgValue + '&typ=' + typValue;
  }
}

function editProfile(path, category){
  if(category != ''){
    switch(category){
    case '1244017409215': template = 'energieberater'
                          break;
    case '1244017448371': template = 'fotograf'
                          break;
    case '1244017442074': template = 'lichtplaner'
                          break;
    case '1244017433090': template = 'pr'
                          break;
    case '1244017418981': template = 'visualisierung'
                          break;
    default: template = 'architekt'
  }
    var overlayProfil = "profil_" + template + "_edit";
    location.href = '/arcguide/profil-bearbeiten.php?overlayProfil=' + overlayProfil + '&berufsgruppe=' + category + '&pathProfile=' + path;
  }
  else{
    location.href = '/arcguide/profil-bearbeiten.php?overlayProfil=profil_nojob_edit&pathProfile=' + path;
  }
}

function updateProfile(path, category){
    switch(category){
    case '1244017409215': template = 'energieberater'
                          break;
    case '1244017448371': template = 'fotograf'
                          break;
    case '1244017442074': template = 'lichtplaner'
                          break;
    case '1244017433090': template = 'pr'
                          break;
    case '1244017418981': template = 'visualisierung'
                          break;
    default: template = 'architekt'
  }
    var overlayProfil = "profil_" + template + "_update";
    location.href = '/arcguide/profil-aktualisieren.php?overlayProfil=' + overlayProfil + '&berufsgruppe=' + category + '&pathProfile=' + path;
}

function checkBerufsgruppe(selectedSchwerpunkt){
  
  var berufsgruppe = jQuery('select[name = "berufsgruppen"]').val();
  if(berufsgruppe){
    jQuery('select[name = "schwerpunkte"]').attr('disabled', false);
    jQuery.ajax({
      type: "GET",
      url: "/arcguide/wGlobal/scripts/custom/ajax.php",
      data: "action=selectSchwerpunkt&berufsgruppe="+berufsgruppe+"&selectedSchwerpunkt="+selectedSchwerpunkt,
      success: function(response){
        jQuery('select[name = "schwerpunkte"]').html(response);
      }
  })
  }
  else{
    jQuery('select[name = "schwerpunkte"]').attr('disabled', true);
    jQuery('select[name = "schwerpunkte"]').html('<option>Schwerpunkte</option>');
  }
  if(berufsgruppe != '' && berufsgruppe != 1244017409215 && berufsgruppe != 1244017448371 && berufsgruppe != 1244017442074 && berufsgruppe != 1244017433090 && berufsgruppe != 1244017418981){
    jQuery('select[name = "leistungsphasen"]').attr('disabled', false);
    jQuery('select[name = "spezialgebiete"]').attr('disabled', false);
  }
  else{
    jQuery('select[name = "leistungsphasen"]').attr('disabled', true);
    jQuery('select[name = "spezialgebiete"]').attr('disabled', true);
  }
}

function showProductGroups(id){
  jQuery.ajax({
     type: "GET",
     url: "/arcguide/wGlobal/scripts/custom/ajax.php",
     data: "action=productgroup&groupId="+id,
     beforeSend: function(){
       jQuery('#'+id).append('<img id="loading" src="/arcguide/wGlobal/layout/images/icons/loading.gif"/>');

     },
     success: function(response){
       jQuery('#loading').remove();
       //html = jQuery('#'+id).parent().html();
       jQuery('#'+id).parent()
       .append(response)
       .animate({opacity: 1.0}, 50)
        .fadeIn(1000);
        jQuery('#'+id).parent().find('ul:first').css('margin-top', '10px');
        jQuery('#'+id).parent().find('ul:first').css('margin-bottom', '0px');
       //setProductGroupLink();
       jQuery('#'+id).parent().find('a.groupLink').click(function(event){
          var id = jQuery(this).attr('id');
          event.preventDefault();
          if(jQuery(this).parent().children('ul').is(':hidden') == false){
             jQuery(this).parent().addClass('groupOpen');
           }
           else{
             jQuery('#'+id).parent().removeClass('groupOpen');
           }
          showProductGroups(id);
        });
       jQuery('#'+id).unbind();
       jQuery('#'+id).click(function(){         
         jQuery('#'+id).parent().children('ul').toggle('slow');
         jQuery('#'+id).parent().children('div').toggle('slow');

         if(jQuery('#'+id).parent().children('div').is(':hidden') == false){
           jQuery('#'+id).parent().removeClass('groupOpen');
         }
         else{
           jQuery('#'+id).parent().addClass('groupOpen');
         }
         return false;
       });
       
        
        jQuery('.herstellerCheckbox').click(function(){
          if(jQuery(this).is(':checked')){
            jQuery('#errorHersteller').addClass('closed');
            jQuery('#errorHersteller').removeClass('error');
          }
        });
     }
   });
}


function openProjectManagement(){
   
    var url = '/arcguide/wGlobal/pages/admin.php';
    wOpenPopupURL(url, 800, 460);  
    
}
function openHersteller(object, url){
   
    var checked = jQuery(object).parent().find('input:first').attr('checked');
    jQuery(object).parent().find('input:first').attr('checked', checked);
    window.open(url);
    
    
}
function resetDate(id, id2){
  jQuery('#'+id).val('');
  jQuery('#'+id2+' > input').val('');
  
  if(id == 'start'){
    if(jQuery('#'+id2+' > input').val() == '')
      jQuery('#'+id).addClass('wInputError');  
  }  
}

function parsteDate2Timestamp(date){
  //date-format: '10.06.2009 09:55';
  var datum = date;
  // datum in tag, monat und jahr zerlegen
  var day=datum.substr(0,2);
  var month=datum.substr(3,2);
  var year=datum.substr(6,4);
  var hour=datum.substr(11,2);
  var min=datum.substr(14,2);

  var date  = new Date(month+' '+day+', '+year+' '+hour+':'+min+':00');

  return (date.getTime()/1000);
}

function wSetOffset(object, value){
   object.parentNode.parentNode.style.marginBottom= value +'px';
 }
 /*
function filterProductGroups(){
  var term = jQuery('#termContent').val().toLowerCase();
  var tab  = '#elementHersteller';
  if(jQuery("#produktgruppen:checked").val() == 'produktgruppen'){
    tab = '#elementProductGroups';
  }
  
  jQuery(tab+" .group").each(function (i) {
    var toProof = jQuery(this).text().toLowerCase();
    if(toProof.indexOf(term) != -1){
      jQuery(this).fadeIn(1000);
    }
    else{
      jQuery(this).fadeOut(1000);
    }
  });
}

function filterProductGroupsChars(value){
  var term = value.toLowerCase();
  var tab  = '#elementHersteller';
  if(jQuery("#produktgruppen:checked").val() == 'produktgruppen'){
    tab = '#elementProductGroups';
  }
  jQuery(tab+" .group").each(function (i) {
    var toProof = jQuery(this).text().toLowerCase();
    if(toProof.substring(0,1) != term){
      jQuery(this).fadeOut(1000);
    }
    else{
      jQuery(this).fadeIn(1000);
    }
  });
}

function filterProjects(){
  var filterProjectTerm = document.searchFormContent.searchTerm.value.toLowerCase();
  var projectElements = document.getElementById('elementProductGroups').getElementsByTagName("div");
  for(var i = 0; i < projectElements.length; i ++){
    if(projectElements[i].className == 'group'){
      var idLower = projectElements[i].innerHTML.toLowerCase();
      if(idLower.indexOf(filterProjectTerm) < 0){
        projectElements[i].style.display = "none";
      }
      else{
        projectElements[i].style.display = "block";
      }
    }
  }
}

function filterProjectsChars(value){
  var filterProjectTerm = value.toLowerCase();
  var projectElements = document.getElementById('elementProductGroups').getElementsByTagName("div");
  for(var i = 0; i < projectElements.length; i ++){
    if(projectElements[i].className == 'group'){
      var idLower = projectElements[i].innerHTML.toLowerCase();
      if(idLower.substring(0,1) != filterProjectTerm){
        projectElements[i].style.display = "none";
      }
      else{
        projectElements[i].style.display = "block";
      }
    }
  }
}
*/

jQuery.noConflict();
jQuery(window).unload( function(event) {
  event.preventDefault();
  if (typeof(GUnload) == 'function'){
    GUnload();
  }
}); 

 // Use jQuery via jQuery(...)
jQuery(document).ready(function(){
  detectBrowser();  
  
  if(ieVers == '6.0'){
    jQuery('#ratingText').hover(
      function(){
       jQuery(this).css('color', '#ff0033');
       jQuery(this).css('background', 'transparent url(/arcguide/wGlobal/layout/images/icons/rating_rot.gif) no-repeat 0 1px');
      },
      function(){
        jQuery(this).css('color', '#333333');
       jQuery(this).css('background', 'transparent url(/arcguide/wGlobal/layout/images/icons/rating.gif) no-repeat 0 1px');
      }
    );

    jQuery('.funBox .funSearch li').hover(
      function(){
        jQuery(this).css('background-position', '0 -17px');
        jQuery(this).find('a').css('display', 'block');
        jQuery(this).find('span').hover(
           function(){
             jQuery(this).css('color', '#ff0033');
           },
           function(){
             jQuery(this).css('color', '#000');
           }
        )
      },
      function(){
        jQuery(this).css('background-position', '0 0');
        jQuery(this).find('a').css('display', 'none');
        jQuery(this).find('span').css('color', '#000');
      }
    );
    jQuery('ul#magazine .toggle').hover(
      function(){
       jQuery(this).css('color', '#ff0033');
      },
      function(){
        jQuery(this).css('color', '#000');
      }
    );
  }
  
  if(jQuery('#blockAdvertiseTop').height() == 0){
    jQuery('#blockAdvertiseRight').css('margin-top', '8px');
  }
  jQuery('#wettbewerbe select[name = "land"]').change(function(){
    var wettbewerbsLand = jQuery('#wettbewerbe select[name = "land"]').val();
    if(wettbewerbsLand == 'DE'){
      jQuery('select[name = "bundeslaender"]').attr('disabled', false);
    }
    else{
      jQuery('select[name = "bundeslaender"]').attr('disabled', true);
    }
  });

    var wettbewerbsLand = jQuery('#wettbewerbe select[name = "land"]').val();
    if(wettbewerbsLand == 'DE'){
      jQuery('select[name = "bundeslaender"]').attr('disabled', false);
    }
    else{
      jQuery('select[name = "bundeslaender"]').attr('disabled', true);
    }

  jQuery('#searchButton').click(function(){
    jQuery('#searchForm').submit();
  });
  //Merklistecounter setzen
  setMetaBasketCounter();
  if (typeof(mapLoad) == 'function'){
    mapLoad();  
  }

  if(jQuery('#tagcloudContent').length == 1){
    jQuery.ajax({
     type: "GET",
     url: "/arcguide/wGlobal/scripts/custom/ajax.php",
     data: "action=tagcloud&path="+window.location.pathname,
     success: function(response){
      jQuery("#tagcloudContent").append(response);
      jQuery("#tagcloudContent a").tagcloud({
    	  size: {start: 14, end: 24, unit: "px"}, 
          color: {start: '#909090', end: '#000000'}
    	});
    }
    });
  }
  jQuery('a.groupLink').click(function(event){
    var id = jQuery(this).attr('id');
    event.preventDefault();
    
    if(jQuery(this).parent().children('ul').is(':hidden') == false){
       jQuery(this).parent().addClass('groupOpen');
     }
     else{
       jQuery('#'+id).parent().removeClass('groupOpen');
     }
    showProductGroups(id);
    
  });
  
  jQuery('.areaChars a.chars').click(function(event){
    jQuery('a.chars').removeClass('selected');
    event.preventDefault();
    var setChar = jQuery(this).attr('title');
    jQuery('#firstChar').val(setChar);
    jQuery(this).addClass('selected');
    if(jQuery(this).hasClass('charsDB')){
      jQuery('#searchFormContent').submit();
    }
  });
  
  jQuery('#findenContent').click(function(event){
    event.preventDefault();
    jQuery('#searchFormContent').submit();
  });
  jQuery('#searchFormContent a.finden').click(function(event){
    event.preventDefault();
    jQuery('#searchFormContent').submit();
  });
  jQuery('ul.partnerLogos').reorder();
  
  jQuery('#partnerRandom').reorder('.newPartner');
  jQuery('#partnerRandom').reorder('.news');
  jQuery('#partnerRandom').reorder('.last');
  
  jQuery('ul.teaserList').reorder();
  jQuery('ul.teaserList').reorder();
  //Startseite Job scrollable
  jQuery("div.scrollable").scrollable({
    vertical:true, size: 6,
      next: 'a.next', 
      prev: 'a.prev' 
  });
  jQuery('a.next').click(function(event){
    event.preventDefault();  //Verhindert das Springen zum Anchor
  });
  jQuery('a.prev').click(function(event){
    event.preventDefault();  //Verhindert das Springen zum Anchor
  });
  jQuery('#tickerPage marquee').marquee('pointer').mouseover(function () {
    jQuery(this).trigger('stop');
  }).mouseout(function () {
    jQuery(this).trigger('start');
   }).mousemove(function (event) {
     if (jQuery(this).data('drag') == true) {
       this.scrollLeft = jQuery(this).data('scrollX') + (jQuery(this).data('x') - event.clientX);
     }
   }).mousedown(function (event) {
     jQuery(this).data('drag', true).data('x', event.clientX).data('scrollX', this.scrollLeft);
   }).mouseup(function () {
     jQuery(this).data('drag', false);
   });

  jQuery('#tickerInline marquee').marquee('pointer').mouseover(function () {
    jQuery(this).trigger('stop');
  }).mouseout(function () {
    jQuery(this).trigger('start');
   }).mousemove(function (event) {
     if (jQuery(this).data('drag') == true) {
       this.scrollLeft = jQuery(this).data('scrollX') + (jQuery(this).data('x') - event.clientX);
     }
   }).mousedown(function (event) {
     jQuery(this).data('drag', true).data('x', event.clientX).data('scrollX', this.scrollLeft);
   }).mouseup(function () {
     jQuery(this).data('drag', false);
   });
 
  
  //Bewertung
  jQuery('ul.rating li a').click(function(event){
    event.preventDefault();  //Verhindert das Springen zum Anchor
		jQuery.ajax({
       type: "GET",
       url: "/arcguide/wGlobal/scripts/custom/ajax.php",
       data: "rating="+jQuery(this).text()+"&path="+location.pathname,
       success: function(response){
         jQuery('#ratingText').text('Vielen Dank!');
         jQuery('#ratingText').next().html(response);
       }
     });
	});
	//Kommentare abgeben
	jQuery('a#publizieren').click(function(event){
    event.preventDefault();  //Verhindert das Springen zum Anchor
		jQuery.ajax({
       type: "POST",
       url: "/arcguide/wGlobal/scripts/custom/ajax.php",
       data: "action=comment&name="+jQuery('input#name').val()+"&email="+jQuery('input#email').val()+"&showData="+jQuery('input#showData').attr('checked')+"&meinung="+jQuery('textarea').val()+"&path="+location.pathname,
       success: function(response){
         jQuery('#kommentarForm').slideUp("slow", function () {
           jQuery('#kommentarForm').parent().html("<h2>Vielen Dank für Ihre Meinung!</h2>");
         });
         jQuery('#kommentarForm').slideDown("slow");
         jQuery(response)    
          .fadeOut(1000, function() {
            jQuery('#kommentarPreview').animate({opacity: 1.0}, 200).remove();
          })
          .insertBefore('#markerInsert')
          .animate({opacity: 1.0}, 50)
          .fadeIn(1000);
       }
     });
	});
	//Kommentare preview
	jQuery('a#preview').click(function(event){
	  var validate = true;
	  if(jQuery('input#name').val() == ''){ jQuery('input#name').addClass('wglInputError'); validate = false;}
	  if(jQuery('input#email').val() == ''){ jQuery('input#email').addClass('wglInputError'); validate = false;}
	  if(jQuery('#meinung').val().length < 2){ jQuery('#meinung').addClass('wglInputError'); validate = false;}
	  if(validate == false) return false;
    event.preventDefault();  //Verhindert das Springen zum Anchor
    jQuery.ajax({
       type: "POST",
       url: "/arcguide/wGlobal/scripts/custom/ajax.php",
       data: "action=preview&name="+jQuery('input#name').val()+"&email="+jQuery('input#email').val()+"&showData="+jQuery('input#showData').attr('checked')+"&meinung="+jQuery('textarea').val()+"&path="+location.pathname,
       success: function(response){
         
        jQuery(response)    
        .fadeOut(1000, function() {
          jQuery('#kommentarPreview').animate({opacity: 1.0}, 200).remove();
        })
        .insertBefore('#markerInsert')
        .animate({opacity: 1.0}, 50)
        .fadeIn(1000);
        /* 
         jQuery('#kommentarPreview').slideUp('slow', function () {
           jQuery('#kommentarPreview').remove();
         });
         jQuery('#blockExtraContent .kommentar:last').after(response);
         if(jQuery('#kommentarPreview').is(':hidden')){            
    		   jQuery('#kommentarPreview').addClass('kommentar');
    		   jQuery('#kommentarPreview').slideDown('slow');
         }*/
       }
     });
     
	});
	
  jQuery("textarea#meinung").focus(function() {
    if (jQuery(this).val().length == 1) {
      jQuery(this).val('');
    }
  });
	
	//Scrollt zum Seitenbeginng
  jQuery('a.top').click(function(){
		jQuery.scrollTo( 0, 3000);//reset the screen to (0,0)
		return false;
	});
  jQuery("#comment").click(function() {
    jQuery.scrollTo( '#kommentarlist', 800);
    return false;
  });
  /*
	jQuery("#weiterleiten").click(function() {
	  wOpenPopupURL('/arcguide/seite-empfehlen/index.php?url='+location.pathname+encodeURIComponent(location.search), 640, 480);
	  return false;
	});
	*/
	jQuery("#print").click(function() {
	  wShowPrintpreview();
	  return false;
	});
	jQuery("#back").click(function() {
	  redirect();
	  return false;
	});
  //Suchfeld leeren, wenn hineingeklickt wurde
  jQuery("#term").focus(function() {
    if (jQuery(this).val() == 'SUCHE...') {
      jQuery(this).val('');
    }
  });
  jQuery("#term").blur(function() {
    if (jQuery(this).val() == '') {
      jQuery(this).val('SUCHE...');
    }
  });
  
  jQuery("#termContent").focus(function() {
    if (jQuery(this).val() == 'STICHWORT') {
      jQuery(this).val('');
    }
  });
  jQuery("#termContent").blur(function() {
    if (jQuery(this).val() == '') {
      jQuery(this).val('STICHWORT');
    }
  });
  
  jQuery("#ortContent").focus(function() {
    if (jQuery(this).val() == 'ORT') {
      jQuery(this).val('');
    }
  });
  jQuery("#ortContent").blur(function() {
    if (jQuery(this).val() == '') {
      jQuery(this).val('ORT');
    }
  });
  
  //Ein-/Ausblenden der Kalendertage
  jQuery(".kalenderToggle").css('cursor', 'pointer');
  jQuery(".kalenderToggle").click(function() {  
    if (jQuery(this).next().is(":hidden")) {
      jQuery(this).next().slideDown("slow");
    } else {
      jQuery(this).next().slideUp("slow");
    }
  });
  
  //Ein-/Ausblenden der Archiv
  jQuery("li.toggleArchiv").css('cursor', 'pointer');
  jQuery("li.toggleArchiv > a").click(function() {  
    if (jQuery(this).parent().find('ul:first').is(":hidden")) {
      jQuery(this).parent().find('ul:first').slideDown("slow");
    } else {
      jQuery(this).parent().find('ul:first').slideUp("slow");
    }
    return false;
  });
  
  //Ein-/Ausblenden in den Magazin
  /*
  jQuery(".toggleMagazin").css('cursor', 'pointer');
  jQuery(".toggleMagazin").click(function() {  
    if (jQuery(this).find('div:first').is(":hidden")) {
      jQuery(this).find('div:first').slideDown("slow");
    } else {
      jQuery(this).find('div:first').slideUp("slow");
    }
  });
 
 
  jQuery(".profileToggle").css('cursor', 'pointer');
  jQuery(".profileToggle").click(function() {  
    var toggleBar = jQuery(this);
    if (jQuery(this).next().is(":hidden")) {
      jQuery(this).next().slideDown("slow");
      toggleBar.css('background-position', '0 -18px');
    } else {
      jQuery(this).next().slideUp("slow");
      toggleBar.css('background-position', '0 0');
    }
  })
   */
  //Ein-/Ausblenden in den Profilen
  jQuery(".toggle").css('cursor', 'pointer');
  jQuery(".toggle").click(function(e) {  
    e.preventDefault();
    var toggleBar = jQuery(this);
    
    if (jQuery(this).next().is(":hidden")) {
      jQuery(this).next().slideDown("slow", function(){
      toggleBar.css('background-position', '0 -18px');
      if(toggleBar.is('div.profileToggle')){          
        toggleBar.css('background-position', '0 17px');
      }
      else if(toggleBar.is('h3.profileToggle')){          
        toggleBar.css('margin-bottom', '0');
        toggleBar.css('background-position', '0 -19px');
      }  
      if(toggleBar.parent().attr('class') == 'funBox'){
        toggleBar.parent().css('margin-bottom', '-1px');
      }
      if(toggleBar.children().eq(0).attr('id') == 'searchText'){
        toggleBar.children().eq(0).text('SUCHE AUS');
        toggleBar.css('background-position', '0 -18px');
      }
      if(toggleBar.children().eq(0).attr('id') == 'searchText'){
        toggleBar.children().eq(0).text('SUCHE AUS');
        toggleBar.css('background-position', '0 -18px');
      }
      if(toggleBar.children().eq(0).attr('id') == 'funText'){
        toggleBar.children().eq(0).text('INSPIRIEREN AUS');
        toggleBar.css('background-position', '0 -18px');
      }
      if(toggleBar.children().eq(0).attr('id') == 'buchladenText'){
        toggleBar.children().eq(0).text('RUBRIKEN AUS');
        toggleBar.css('background-position', '0 -18px');
      }
      if(toggleBar.children().eq(1).attr('id') == 'buchladenText'){
        toggleBar.children().eq(1).text('RUBRIKEN AUS');
        toggleBar.css('background-position', '0 -18px');
      }
      if(toggleBar.parent().attr('id') == 'kommentarlist'){
        toggleBar.css('background-position', '0 -18px');
      }
      if(toggleBar.children().eq(0).attr('id') == 'tagcloudText'){
        toggleBar.css('background-position', '0 -18px');
      }
      if(jQuery(this).parent().is('.ratingContainer')){
        jQuery(this).parent().css('padding-bottom', '7px');
        toggleBar.css('background-position', '0 1px');
      }
    });
    } else {      
      jQuery(this).next().slideUp("slow", function(){
        if(toggleBar.parent().attr('class') == 'funBox'){
        toggleBar.parent().css('margin-bottom', '0');
      }
        if(toggleBar.is('div.profileToggle')){          
          toggleBar.css('background-position', '0 -1px');
        }
        else if(toggleBar.is('h3.profileToggle')){          
          toggleBar.css('background-position', '0 -2px');
          toggleBar.css('margin-bottom', '-1px');
        }
        else{
          toggleBar.css('background-position', '0 0');
        }
      
        if(toggleBar.children().eq(0).attr('id') == 'searchText'){
          toggleBar.children().eq(0).text('SUCHE EIN');
          toggleBar.css('background-position', '0 0');
        }
        if(toggleBar.children().eq(0).attr('id') == 'funText'){
          toggleBar.children().eq(0).text('INSPIRIEREN EIN');
          toggleBar.css('background-position', '0 0');
        }
        if(toggleBar.children().eq(0).attr('id') == 'buchladenText'){
          toggleBar.children().eq(0).text('RUBRIKEN EIN');
          toggleBar.css('background-position', '0 0');
        }
        if(toggleBar.children().eq(1).attr('id') == 'buchladenText'){
          toggleBar.children().eq(1).text('RUBRIKEN EIN');
          toggleBar.css('background-position', '0 0');
        }
        if(toggleBar.parent().attr('id') == 'kommentarlist'){
          toggleBar.css('background-position', '0 0');
        }
        if(toggleBar.children().eq(0).attr('id') == 'tagcloudText'){
          toggleBar.css('background-position', '0 0');
        }
        if(jQuery(this).parent().is('.ratingContainer')){
          jQuery(this).parent().css('padding-bottom', '0px');
          toggleBar.css('background-position', '0 1px');
        }
      });
    }
    
    if(jQuery(this).find('span.floatRight').is(":hidden")){
      jQuery(this).find('span.floatRight').fadeIn('slow');
      
      jQuery(this).find('span.floatRight').addClass('borderImg');
    }
    else {
      jQuery(this).find('span.floatRight').fadeOut('slow');
      
      jQuery(this).find('span.floatRight').removeClass('borderImg');
    }
  });
  
  //Ein-/Ausblenden der Google Map
  
  jQuery("#toggleMap").click(function(event) {  
    event.preventDefault();
    if (jQuery("#googleMaps").is(":hidden")) {
      jQuery("#googleMaps").slideDown("slow");
      jQuery(this).removeClass('mapIcon');
      jQuery(this).addClass('mapIconActive');
      jQuery(this).attr('title', 'schließe Google-Maps');
    } else {
      jQuery("#googleMaps").slideUp("slow");
      jQuery(this).addClass('mapIcon');
      jQuery(this).removeClass('mapIconActive');
      jQuery(this).attr('title', 'öffne Google-Maps');
    }
  });
  /*
  //Ein-/Ausblenden des Tickers 
  jQuery("#tickerToggle").css('cursor', 'pointer');
  jQuery("#tickerToggle").click(function() {  
    if (jQuery("#tickerContent").is(":hidden")) {
      jQuery("#tickerContent").slideDown("slow");
      jQuery("#tickerText").text('TICKER OFF');
    } else {
      jQuery("#tickerContent").slideUp("slow");
      jQuery("#tickerText").text('TICKER ON');
    }
  });
  
  //Ein-/Ausblenden der TagCloud
  jQuery("#tagcloudToggle").css('cursor', 'pointer');
  jQuery("#tagcloudToggle").click(function() {  
    if (jQuery("#tagcloudContent").is(":hidden")) {
      jQuery("#tagcloudContent").slideDown("slow");
    } else {
      jQuery("#tagcloudContent").slideUp("slow");
    }
  });
  */
  //Ein-/Ausblenden des Material bestellen 
  jQuery("#orderToggle").css('cursor', 'pointer');
  jQuery("#orderToggle").click(function() {  
    if (jQuery("#orderContent").is(":hidden")) {
      jQuery("#orderContent").slideDown("slow");
      jQuery(this).css('background-position', '0 -18px');
    } else {
      jQuery("#orderContent").slideUp("slow");
      jQuery(this).css('background-position', '0 0');
    }
  });
  
   //Ein-/Ausblenden des Hotline 
   /*
  jQuery("#hotlineToggle").css('cursor', 'pointer');
  jQuery("#hotlineToggle").click(function() {  
    if (jQuery("#hotlineContent").is(":hidden")) {
      jQuery("#hotlineToggle").css('height', '19px');
      jQuery("#hotlineContent").slideDown("slow");
    } else {      
      jQuery("#hotlineContent").slideUp("slow");
      jQuery("#hotlineToggle").css('height', '17px');
    }
  });
  */
  //Fancybox auf Bilder in group2 legen
  /*
  jQuery("a.group").fancybox({
    'hideOnContentClick': true,
    'zoomOpacity': true, 
    'zoomSpeedChange': 600,
    'zoomSpeedIn': 300, 
    'zoomSpeedOut': 300, 
    'overlayShow': false, 
    'overlayOpacity': 1
  });
  
  //Bilderstrecke starten
  jQuery("a#slideshow").css('cursor', 'pointer');
  jQuery("a#slideshow").click(function() {
    jQuery("a.group:first").click();
  });
  */
  //Tickertext einblenden
  window.setTimeout("jQuery('#tickerInline marquee').css('visibility', 'visible')", 2000);
  window.setTimeout("jQuery('#tickerPage marquee').css('visibility', 'visible')", 2000);
  window.setTimeout("jQuery('#tickerContent marquee').css('visibility', 'visible')", 2000);
});
 
function getNext(){
  if(currentImage == Images.length-1){
    currentImage = 0;
    displayPicturePosition('begin');
  }
  else{
  currentImage++;
  displayPicturePosition();
  }
  setPicture();
  setDescription();
  setCopyRight();
  checkNavigation();
}

function getPrevious(){
  currentImage--;        
  displayPicturePosition('minus');
  setPicture();
  setDescription();
  setCopyRight();
  checkNavigation();
}

function checkNavigation(){    
  if(currentImage == (Images.length-1) && Images.length != 1){
    jQuery('#nextPicture').css('visibility', 'hidden');
    jQuery('#nextPictureBottom').css('visibility', 'hidden');
    jQuery('#prevPicture').css('visibility', 'visible');
    jQuery('#prevPictureBottom').css('visibility', 'visible');
  }
  else if(currentImage == 0){
    jQuery('#prevPicture').css('visibility', 'hidden');
    jQuery('#prevPictureBottom').css('visibility', 'hidden');
    jQuery('#nextPicture').css('visibility', 'hidden');
    jQuery('#nextPictureBottom').css('visibility', 'hidden');
    if(Images.length > 1){
      jQuery('#nextPicture').css('visibility', 'visible');
      jQuery('#nextPictureBottom').css('visibility', 'visible');
    }
  }
  else{
    jQuery('#nextPicture').css('visibility', 'visible');
    jQuery('#nextPictureBottom').css('visibility', 'visible');
    jQuery('#prevPicture').css('visibility', 'visible');
    jQuery('#prevPictureBottom').css('visibility', 'visible');
  }
}

function displayPicturePosition(type){
  if(type == 'begin'){
    showCurrentCount = 1;
  }
  else if(type == 'minus'){
    showCurrentCount--;
  }
  else{
    showCurrentCount++;
  }
  
  jQuery('#currentPicture').html(showCurrentCount);
  jQuery('#currentPictureBottom').html(showCurrentCount);
}

function setPicture(){
  //jQuery('#image').attr('src', Images[currentImage]);
  jQuery('#image').ImageSwitch({Type:'FadeIn', NewImage:Images[currentImage], EffectOriginal:true,Speed:1});         
  jQuery('#image').attr('alt', Description[currentImage]);
}

function setDescription(){
  jQuery('#imageDescription').html(Description[currentImage]);
}

function setCopyRight(){
  if(Copyright[currentImage] != ''){
    jQuery('#imageCopyright').show();
    jQuery('#imageCopyrightText').html(Copyright[currentImage]);
  }
  else{
    jQuery('#imageCopyright').hide();
  }
}


////////////////////////////////////////////////////////////////
//
// wScript.js 5.0.1
// erstellt durch Scholl Communications AG, 77694 Kehl, www.scholl.de
// erstellt mit Weblication Content Management Server, www.weblication.de
//
////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////
//
// Anzupassende Variablen:
//
////////////////////////////////////////////////////////////////

var mailPostfix = '@domain.dd';


////////////////////////////////////////////////////////////////
//
// Beschreibung: Oeffnet ein Popup-Fenster
//
////////////////////////////////////////////////////////////////

function openPopup(url){

 if(debugMode == 1){
  alert(url);
 }

 window.open(url, "popup", optionsPopup);
}

////////////////////////////////////////////////////////////////
//
// Beschreibung: Oeffnet ein Popup-Fenster vom Typ 1
//
////////////////////////////////////////////////////////////////

function openPopup1(url){

 if(debugMode == 1){
  alert(url);
 }

 window.open(url, "popup1", optionsPopup1);
}

////////////////////////////////////////////////////////////////
//
// Beschreibung: Oeffnet ein Popup-Fenster vom Typ 2
//
////////////////////////////////////////////////////////////////

function openPopup2(url){

 if(debugMode == 1){
  alert(url);
 }

 window.open(url, "popup2", optionsPopup2);
}


////////////////////////////////////////////////////////////////
//
// Beschreibung: Zeigt die Druckansicht an
//
////////////////////////////////////////////////////////////////

function wShowPrintpreview(){  

  var url = location.href;
  var anchor = location.hash;

  url = url.replace(anchor, '');
  
  if(url.indexOf('?') >= 0){
    url += '&viewmode=print';
  }
  else{
    url += '?viewmode=print';    
  }
  
  openWindow(url, 'Druckansicht', 'width=768,height=520,scrollbars=yes');
}

////////////////////////////////////////////////////////////////
//
// Beschreibung: Zeigt die Weiterleiten an
//
////////////////////////////////////////////////////////////////

function wShowWeiterleiten(){  

  var url = '/arcguide/seite-empfehlen/?url='+location.pathname+encodeURIComponent(location.search);
  
  
  openWindow(url, 'Seite weiterempfehlen', 'width=350,height=250,scrollbars=yes');
}

/*********************************************************************************/
//
// �ffnet ein Fenster
//
// @param string Url
//
// @param string Name des Fensters
//
// @param string Optionen
//
// @return window			
//
/*********************************************************************************/

function openWindow(url, name, options){

  var regWidth = /width=(\d+)/;
  regWidth.exec(options);
  width = RegExp.$1; 
  if(width == ''){   
    width = 640; 
  }

  var regHeight = /height=(\d+)/;
  regHeight.exec(options);
  height = RegExp.$1;       
  if(height == ''){   
    height = 480; 
  }    


  if(!name && !width && !height && !options){
    return window.open(url, name);
    return;
  }
  //Zusaetzliche Optionen angeben
  if(!options){
    options = ',resizable=no,scrollbars=no,status=no';
  }
  //Position zentriert festlegen
  
  var posLeft = (screen.width / 2)  - (width  / 2);
  var posTop  = (screen.height / 2) - (height / 2);
  //alert('top='+posTop+',left='+posLeft+',width='+width+',height='+height+',' + options);<<<
  return window.open(url, name, 'top='+posTop+',left='+posLeft+',width='+width+',height='+height+',' + options);
}

////////////////////////////////////////////////////////////////
//
// Beschreibung: Druckt das aktuelle Dokument
//
////////////////////////////////////////////////////////////////

function printDocument(){  

  if(document.all && navigator.appVersion.substring(22,23)==4) {
    self.focus();
    var OLECMDID_PRINT = 6;
    var OLECMDEXECOPT_DONTPROMPTUSER = 2;
    var OLECMDEXECOPT_PROMPTUSER = 1;
    var WebBrowser = '<object id="WebBrowser1" width="0" height="0" classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></object>';
    document.body.insertAdjacentHTML('beforeEnd',WebBrowser);
    WebBrowser1.ExecWB(OLECMDID_PRINT,OLECMDEXECOPT_DONTPROMPTUSER);
    WebBrowser1.outerHTML = '';
  }
  else{
    window.print();  
  }
}

/*********************************************************************************/
//
// @description Ruft eine URL auf
//
// @parameter   String Aufzurufende Url
//
// @parameter   Function Nach der Anfrage aufzurufende Funktion
//
// @return      void
//
/*********************************************************************************/

function getUrl(url, functionResult){

  var requestObject = new wRequestObject(url, functionResult);
}

/*********************************************************************************/
//
// @description Ruft eine URL auf
//
// @parameter   String Aufzurufende Url
//
// @parameter   Function Nach der Anfrage aufzurufende Funktion
//
// @return      void
//
/*********************************************************************************/

function wRequestObject(url, functionResult){

  if(typeof functionResult == 'function'){
    var id              = resultFunctions.length;
    //alert(id);

    this.request        = null;

    if(document.all){
      this.request = new ActiveXObject("Microsoft.XMLHTTP");
    }
    else{
      this.request = new XMLHttpRequest();
    }

    resultFunctions.push(functionResult);
    //alert('push' +  requests.length);

    requests.push(this.request);
    this.request.open('GET', url, true);

    this.request.onreadystatechange = function(){
      var requestObject = requests[id];
      if(requestObject.readyState == 4){
        if(requestObject.status == '200'){
          resultFunctions[id](requestObject.responseText);
        }
      }
    }

    this.request.send('');
  }
}

/***************************************************
* @info  : Oeffnet eine URL in einem popUp         *
* @param : url   : Zu oeffnende URL                *
*          width : Breite des Fensters             *
*          height: Hoehe des Fensters              *
* @return: -                                       *
***************************************************/

function wOpenPopupURL(url, width, height){
  var name = '';
  
  if(width == '' || width == ' '){
    width = 786;
  }
  if(height == '' || height == ' '){
    height = 677;
  }
  url = url.replace(/&amp;/g, '&');
  options = ',location=no, menubar=no,toolbar=no,resizable=no,scrollbars=no,status=no';
  width   = parseInt(width);
  height  = parseInt(height);
  //Position zentriert festlegen
  var posLeft = (screen.width / 2)  - (width  / 2);
  var posTop  = (screen.height / 2) - (height / 2);
  window.open(url, name, 'top='+posTop+',left='+posLeft+',width='+width+',height='+height+',' + options);
}


function wOpenPopupVideo(src, width, height){
  var name = '';

  if(width == '' || width == ' '){
    width = 786;
  }
  if(height == '' || height == ' '){
    height = 677;
  }
  var src       = src.replace(/&amp;/g, '&');
  var srcFrame  = '/wDeutsch/wGlobal/content/areas/popup.area.php';
  var url       = srcFrame+'?vid='+src;
  
  //alert (url);
  options = ',location=no, menubar=no,toolbar=no,resizable=no,scrollbars=no,status=no';
  width   = parseInt(width);
  height  = parseInt(height);
  //Position zentriert festlegen
  var posLeft = (screen.width / 2)  - (width  / 2);
  var posTop  = (screen.height / 2) - (height / 2);
  window.open(url, name, 'top='+posTop+',left='+posLeft+',width='+width+',height='+height+',' + options);
}

/***************************************************
* @info  : Oeffnet ein Bild in einem popUp         *
* @param : url   : Zu oeffnende URL                *
* @return: -                                       *
***************************************************/

function wOpenImageAdaptSize(url){

  var name = '';
  var path = '/weblication/grid/scripts/wImage.php?action=getImageSize&path='+url;
  curImageUrl = url;
  getUrl(path, wOpenImageAdaptSizeResponse);
}

function wOpenImageAdaptSizeResponse(response){
  
  var name = '';
  var size = response;
  if(response == ''){
    size = 'width="800" height="600"';
  }
  
  var regex = /(?:")(\d+?)(?:").*(?:")(\d+?)(?:")/;
  var match = size.match(regex);d 
  
  if(match){
    width   = match[1];
    height  = match[2]; 
  }
  else{
    width   = 800;
    height  = 600;
  }
  
  curImageUrl = curImageUrl.replace(/&amp;/g, '&');
  options = ',location=no, menubar=no,toolbar=no,resizable=no,scrollbars=no,status=no';
  width   = parseInt(width);
  height  = parseInt(height);
  //Position zentriert festlegen
  var posLeft = (screen.width / 2)  - (width  / 2);
  var posTop  = (screen.height / 2) - (height / 2);
  window.open(curImageUrl, name, 'top='+posTop+',left='+posLeft+',width='+width+',height='+height+',' + options);
}

////////////////////////////////////////////////////////////////
//
// Beschreibung: Generiert Spam-sichere Email
//
////////////////////////////////////////////////////////////////

function wWriteMail(name){
	//location.href = 'mailto:' + name + '@scholl.de';
  location.href = 'mailto:' + name + mailPostfix;
}

////////////////////////////////////////////////////////////////
//
// Beschreibung: Druckt das aktuelle Dokument
//
////////////////////////////////////////////////////////////////

function wPrintDocument(){

  if(document.all && navigator.appVersion.substring(22,23)==4) {
    self.focus();
    var OLECMDID_PRINT = 6;
    var OLECMDEXECOPT_DONTPROMPTUSER = 2;
    var OLECMDEXECOPT_PROMPTUSER = 1;
    var WebBrowser = '<object id="WebBrowser1" width="0" height="0" classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></object>';
    document.body.insertAdjacentHTML('beforeEnd',WebBrowser);
    WebBrowser1.ExecWB(OLECMDID_PRINT,OLECMDEXECOPT_DONTPROMPTUSER);
    WebBrowser1.outerHTML = '';
  }
  else{
    window.print();  
  }
}

////////////////////////////////////////////////////////////////
//
// Beschreibung: Generiert Spam-sichere Email
//
////////////////////////////////////////////////////////////////

function wSendMailNospam(name){

  location.href = 'mailto:' + name + mailPostfix;
}

////////////////////////////////////////////////////////////////
//
// Beschreibung: Setzt die Sprachversion
//
////////////////////////////////////////////////////////////////

function wSetLanguageVersion(langVersion, redirectUrl){
  //var url = '/weblication/grid/scripts/wSystem.php?action=setLanguageVersion&redirectUrl=' + escape(redirectUrl) + '&langVersion=' + langVersion;
  var url = '/weblication/grid/scripts/wSystem.php?action=setLanguageVersion&redirectUrl=' + decodeURI(redirectUrl) + '&langVersion=' + langVersion;
  location.href = url;
}

function languageSelector(id) {
	if(document.getElementById(id)) {
		if(document.getElementById(id).style.display == 'none' || document.getElementById(id).style.display == '') {
			document.getElementById(id).style.display = 'block';
		} else {
			document.getElementById(id).style.display = 'none';
		}
	}
}

var shopId = 'wShop';
var shopIdOrdner = 'wShopOrdner';

function getUrlsBasket(info, option){

  var urlStr = getCookie(shopId);

  var urls = urlStr.split('~___');
  
  var urlsChecked = new Array();

  for(var i = 0; i < urls.length; i++){
    if(urls[i] != ''){
      urlsChecked.push(urls[i].replace(/p\:/, ''));       
    }       
  }    
  return urlsChecked;  
}

function getNumberUrls(){

  var urlStr = getCookie(shopId);
  var urls = urlStr.split('~___');
  
  var urlStrOrdner = getCookie(shopIdOrdner);
  var urlsOrdner = urlStrOrdner.split('~___');
    
  return urls.length - 1 + urlsOrdner.length - 1;    
}

function isURLInBasket(url){

  var urlStr = getCookie(shopId);
  var regExpStr;

  var urlReg = url.replace(/\//g, '\\/');
  
  var existsUrl = new RegExp(urlReg + "~_~");
  if(existsUrl.test(urlStr) == true){
    return true;
  }
  return false;
}  

function isURLInBasketOrdner(url, title, typ){

  var urlStr = getCookie(shopIdOrdner);
  var regExpStr;

  var urlReg = url.replace(/\//g, '\\/');
  
  var existsUrl = new RegExp(urlReg + "~_~" + title + "~_~" + typ);
  if(existsUrl.test(urlStr) == true){
    return true;
  }
  return false;
}  

function addURLToBasket(url, title){

  var urlStr = getCookie(shopId);
  var regExpStr;
  
  var urlReg = url.replace(/\//g, '\\/').replace(/\(/g, '\\(/').replace(/\)/g, '\\)/');   
  
  var existsUrl = new RegExp(urlReg + "~_~");
  if(existsUrl.test(urlStr) == true){
    setUrls(urlStr);
  }
  else{
    urlStr = urlStr + url + "~_~" + title + "~___";
    setUrls(urlStr);
  }
  setMetaBasketCounter();
} 



function addURLToBasketOrdner(url, title, typ){

  var urlStr = getCookie(shopIdOrdner);
  var regExpStr;
  
  var urlReg = url.replace(/\//g, '\\/').replace(/\(/g, '\\(/').replace(/\)/g, '\\)/');
  
  var existsUrl = new RegExp(urlReg + "~_~" + title + "~_~" + typ);
  
  if(existsUrl.test(urlStr) == true){
    setUrlsOrdner(urlStr);
  }
  else{
    urlStr = urlStr + url + "~_~" + title + "~_~" + typ + "~___";
    setUrlsOrdner(urlStr);
  }
  setMetaBasketCounter();
} 



function removeURLFromBasket(url, title){

  var urlStr = getCookie(shopId);
  var regExpStr;
  
  var urlReg = url.replace(/\//g, '\\/').replace(/\(/g, '\\(/').replace(/\)/g, '\\)/');    
  
  var existsUrl = new RegExp(urlReg + "~_~");
  
  if(existsUrl.test(urlStr) == true){
    urlStr      = urlStr.replace(url + "~_~" + title + "~___", "");      
  }      

  setUrls(urlStr);
  setMetaBasketCounter();
}  

function removeURLFromBasketOrdner(url, title, typ){

  var urlStr = getCookie(shopIdOrdner);
  var regExpStr;
  
  var urlReg = url.replace(/\//g, '\\/').replace(/\(/g, '\\(/').replace(/\)/g, '\\)/');    
  
  var existsUrl = new RegExp(urlReg + "~_~" + title + "~_~" + typ);
  
  if(existsUrl.test(urlStr) == true){
    urlStr      = urlStr.replace(url + "~_~" + title + "~_~" + typ + "~___", "");      
  }      
  setUrlsOrdner(urlStr);
  setMetaBasketCounter();
}  

function setMetaBasketCounter(){
  var basketNumbers = getNumberUrls();

  if(basketNumbers < 10 && basketNumbers > 0){
    basketNumbers = '0'+basketNumbers;
  }
  
  jQuery('#countClips').text('['+basketNumbers+']');
  if(basketNumbers > 0){
    jQuery('#countClips').parent().parent().addClass('navLevel1Selected');
  }
  else{
    jQuery('#countClips').parent().parent().removeClass('navLevel1Selected');
  }
}

function clearBasket (){
  
  document.cookie = shopId + "=; path=/;";
}
  
function setUrls(urlStr){

  document.cookie = shopId + "=" + urlStr + "; path=/;";
}

function setUrlsOrdner(urlStr){

	  document.cookie = shopIdOrdner + "=" + urlStr + "; path=/;";
	}

function getCookie(name){

  var cookieStr = document.cookie;
  if(name && name != ''){        
    var nameReg = new RegExp(name + '=');
    
    cookiePos = cookieStr.search(nameReg);
    
    if(cookiePos != -1){
      cookieStr = cookieStr.substring(cookiePos);   
      cookieStr = cookieStr.replace(nameReg, '');
      cookieStr = cookieStr.replace(/;.*/, '');
    }
    else{
      cookieStr = "";
    }  
  }
  return cookieStr;
}


jQuery(document).ready(function($){
    $.os = {
			name: (/(win|mac|linux|sunos|solaris|iphone)/.exec(navigator.platform.toLowerCase()) || [u])[0].replace('sunos', 'solaris')
		};

    var userAgent = navigator.userAgent.toLowerCase();
    $.browser.chrome = /chrome/.test(navigator.userAgent.toLowerCase()); 
    // Is this a version of IE?
    if($.browser.msie){
        $('body').addClass('browserIE');
        
        // Add the version number
        $('body').addClass('browserIE' + $.browser.version.substring(0,1));
    }
    
    
    // Is this a version of Chrome?
    if($.browser.chrome){
    
        $('body').addClass('browserChrome');
        
        //Add the version number
        userAgent = userAgent.substring(userAgent.indexOf('chrome/') +7);
        userAgent = userAgent.substring(0,1);
        $('body').addClass('browserChrome' + userAgent);
        
        // If it is chrome then jQuery thinks it's safari so we have to tell it it isn't
        $.browser.safari = false;
    }
    
    // Is this a version of Safari?
    if($.browser.safari){
        $('body').addClass('browserSafari');
        
        // Add the version number
        userAgent = userAgent.substring(userAgent.indexOf('version/') +8);
        userAgent = userAgent.substring(0,1);
        $('body').addClass('browserSafari' + userAgent);
    }
    
    // Is this a version of Mozilla?
    if($.browser.mozilla){
        
        //Is it Firefox?
        if(navigator.userAgent.toLowerCase().indexOf('firefox') != -1){
            $('body').addClass('browserFirefox');
            
            // Add the version number
            userAgent = userAgent.substring(userAgent.indexOf('firefox/') +8);
            userAgent = userAgent.substring(0,1);
            $('body').addClass('browserFirefox' + userAgent);
        }
        // If not then it must be another Mozilla
        else{
            $('body').addClass('browserMozilla');
        }
    }
    
    // Is this a version of Opera?
    if($.browser.opera){
        $('body').addClass('browserOpera');
    }

    $('body').addClass($.os.name);

});