if (typeof project == 'undefined') var project = {};
(function($) {
  project.siteConfig = { siteId: null }; //siteConfig Object, can hold e.g. siteId attribtue

  project.initHeaderLoginForm = function() {
    $('#login_login, #login_password').each(function(idx, element) {
      var $element = $(element);
      $element.bind('focus', function() {
        $(element.id+'_labelspan').hide();
      });
      $element.bind('blur', function() {
        if (element.value === '') {
          $(element.id+'_labelspan').show();
        }
      });
      $($element.attr('id')+'_labelspan').click(function() {
        $(element.id+'_labelspan').hide();
        element.focus();
      })
    });
  }

  project.logoFlyout = {};
  project.logoFlyout.show = function() {
    $('#navLogo').addClass('expanded');
  }
  project.logoFlyout.hide = function() {
    $('#navLogo').removeClass('expanded');
  }
  project.logoFlyout.init = function() {
    $('#navLogo li').bind('mouseover', project.logoFlyout.show).bind('mouseout', project.logoFlyout.hide);
  }

  //DEPRECATED: project.showLoading - use common.showLoading instead
  project.showLoading = function($container) {
    common.log('deprecated method called: project.showLoading - use common.showLoading instead');
    return common.showLoading($container);
  };
  //DEPRECATED: project.hideLoading - use common.hideLoading instead
  project.hideLoading = function($container) {
    common.log('deprecated method called: project.hideLoading - use common.hideLoading instead');
    return common.hideLoading($container);
  };

  project.showCacheInfo = function()
  {
    if (self.document.location.hash.match(/#cacheInfo/)) {
      var $cacheInfo = $('<ul id="gujCacheInfo">');
      var cacheInfoHtml = '<li><strong>caching enabled:</strong> '+(project.cacheInfo.cachingEnabled ? 'yes' : 'no')+'</li>';
      cacheInfoHtml += '<li><strong>max-age:</strong> '+project.cacheInfo.max_age+' seconds / '+parseInt(project.cacheInfo.max_age/60, 10)+ ' minutes</li>';
      cacheInfoHtml += '<li><strong>cache date:</strong> '+project.cacheInfo.cache_date+'</li>';
      cacheInfoHtml += '<li><strong>expire date:</strong> '+project.cacheInfo.expire_date+'</li>';
      $cacheInfo.html(cacheInfoHtml);
      $('body').prepend($cacheInfo);
    }
    else {
      $('#gujCacheInfo').remove();
    }
  }
  $(document).ready(project.showCacheInfo);
  $(window).bind('hashchange', project.showCacheInfo);

  /*
  CSS Browser Selector v0.3.5 (Feb 05, 2010)
  Rafael Lima (http://rafael.adm.br)
  http://rafael.adm.br/css_browser_selector
  License: http://creativecommons.org/licenses/by/2.5/
  Contributors: http://rafael.adm.br/css_browser_selector#contributors
  */
  function css_browser_selector(u){var ua = u.toLowerCase(),is=function(t){return ua.indexOf(t)>-1;},g='gecko',w='webkit',s='safari',o='opera',h=document.documentElement,b=[(!(/opera|webtv/i.test(ua))&&/msie\s(\d)/.test(ua))?('ie ie'+RegExp.$1):is('firefox/2')?g+' ff2':is('firefox/3.5')?g+' ff3 ff3_5':is('firefox/3.6')?g+' ff3 ff3_6':is('firefox/3')?g+' ff3':is('gecko/')?g:is('opera')?o+(/version\/(\d+)/.test(ua)?' '+o+RegExp.$1:(/opera(\s|\/)(\d+)/.test(ua)?' '+o+RegExp.$2:'')):is('konqueror')?'konqueror':is('chrome')?w+' chrome':is('iron')?w+' iron':is('applewebkit/')?w+' '+s+(/version\/(\d+)/.test(ua)?' '+s+RegExp.$1:''):is('mozilla/')?g:'',is('j2me')?'mobile':is('iphone')?'iphone':is('ipod')?'ipod':is('mac')?'mac':is('darwin')?'mac':is('webtv')?'webtv':is('win')?'win':is('freebsd')?'freebsd':(is('x11')||is('linux'))?'linux':'','js']; c = b.join(' '); h.className += ' '+c; return c;};
  css_browser_selector(navigator.userAgent);
})(jQuery);

