jQuery.noConflict();
jQuery(document).ready(function($){
  
  if( !($.browser.msie && $.browser.version=="6.0") ) {

    var i = 0.0;
    var k = 0.0;
    setInterval(function(){
      xOffset = Math.round(-2000 * Math.sin(i *Math.PI/180));
      i += 0.1;

      $('#super-wrapper').css('background-position', xOffset + 'px 0px');    
    }, 41);

    $(window).scroll( function() {
      $('#super-wrapper').css('top', $(window).scrollTop() + 'px');  
    });
    
    $('#super-wrapper').css('top', $(window).scrollTop() + 'px');  
  } else {
    $('#super-wrapper').hide();
  }
// Background animation 

//  $('#super-wrapper').animate({backgroundPosition: "(-9000px 0)" }, {duration:50000});
//browser check
if ( $.browser.msie ) {
$("body").addClass("explorer" + parseInt($.browser.version) );
}
if ( $.browser.opera ) {
$("body").addClass("opera" + parseInt($.browser.version) );
}
if ( $.browser.webkit ) {
$("body").addClass("webkit");
}
if ( $.browser.mozilla ) {
$("body").addClass("firefox");
} 
// Nav


  var sPath = window.location.pathname;
  sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
/*	sPage = sPage.substring(5, sPage.length - 5);*/
	if (sPage == 'index') sPage = 'home';
	var activeClass ='#sn' + sPage;
	$(activeClass).addClass("active");
	$('.active').fadeIn(1000);

  //$('#nav ul').sprites();
//nav refelctions
$('#nav a').FontEffect({
					   mirror:true,
					   mirrorColor : '#FFFFFF',
					   mirrorOffset: -11,
					   mirrorHeight: 90,
					   mirrorTStart: 0.1,
					   mirrorTLength: 90,
					   mirrorDetail:1 
						});  
// E-mail defuscator

  $('a[href^="mailto:"]').addClass('email');
  if ($('a.email').length > 0) { $('a.email').defuscate(); }

// External links auto-styler

  $('p a').filter(function() {
    return this.hostname && this.hostname !== location.hostname;
  }).addClass('external');

  $('a.external').click(function(){
    window.open(this.href);
    return false;
  });

// Button styling

  $('button').hover( function() { $(this).css ('cursor', 'pointer') })

	$('.submitBtn').hover(
		function(){ $(this).addClass('submitBtnHover'); },
		function(){ $(this).removeClass('submitBtnHover'); }
	);	

// Addthis button

	$('#addthis').hover(
		function(){ return addthis_open(this, '', '[URL]', '[TITLE]'); },
		function(){ addthis_close();  }
	);	
  $('#addthis').click(function(){ return addthis_sendto(); });

// Swap value text form

    swapValues = [];
    $(".swap-value").each(function(i){
        swapValues[i] = $(this).val();
        $(this).focus(function(){
            if ($(this).val() == swapValues[i]) {
                $(this).val("");
            }
        }).blur(function(){
            if ($.trim($(this).val()) == "") {
                $(this).val(swapValues[i]);
            }
        });
    });  
  
	$('.opacity50').hover(
		function(){ $(this).fadeTo('fast', 1); },
		function(){ $(this).fadeTo('fast', 0.5);  }
	);	

	$('.opacity75').hover(
		function(){ $(this).fadeTo('fast', 1); },
		function(){ $(this).fadeTo('fast', 0.75);  }
	);	

  if( !($.browser.msie && $.browser.version=="6.0") ) {
    $('#promo').crossSlide({
      speed: 15,
      fade: 1
   }, [
      { src: 'img/promo.jpg', dir: 'down', title: 'Leaders in joint care and mobility' },
      { src: 'img/promo2.jpg', dir: 'up', title: 'Aroma, helping create healthy joints and tendons' },      
      { src: 'img/promo3.jpg', dir: 'down', title: 'The source of healthy nutrition' }
    ]);
  }

    $('.text-line').fadeIn('slow');

  $(".simple_overlay").appendTo('body');

  $("img[rel]").overlay();
  
  $('#event').hover( function(){
      $(this).css('cursor', 'pointer');
  }, function() { $(this).css('cursor', 'default'); })
  $('#event').click( function(){ 
      window.location = '/events';
  });


});


