
   
/* 
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-17260784-1']);
_gaq.push(['_trackPageview']);

(function() {
  var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
  ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
    })();
*/    
$(document).ready(function(){
  
    /* Dots Slider 1 */
    $(function(){
      var $img = $(".imageSliderImageChild").first(); 
      //alert($img.attr("height"));
      $('#imageSlider').first()
        .after('<div id="imageSliderNav" style="top:' + ($img.attr("height") - 5) + 'px;">')
        .cycle({
        fx:  'fade',
        speed:  1550,
        timeout: 8000,
        pager:  '#imageSliderNav',
        pagerAnchorBuilder: function(idx, slide) {
          return '<a href="#"><span>' + idx + '</span></a>';
          }
      });     
      
     $('.imageSliderImageChild').show();  
     $('.imageSliderImageChild').css('visibility','visible'); 

  });
  
  
    $(function() {
      $( "#accordion" ).accordion({
  clearStyle: true,
  autoHeight: false,
  collapsible: true,
  active: false }).find('.tools a').click(function(ev){
           ev.preventDefault();
           ev.stopPropagation();
           document.location.href=ev.target;
          });
      
      var $acc = $( "#fixedaccordion" ).accordion({
        clearStyle: true,
        autoHeight: false,
        collapsible: true,
        navigation: true,
        navigationFilter:  function(ix, url) {
    if ( this.href.toLowerCase() == location.href.toLowerCase()) {
      
      var $url = this.href.toLowerCase().replace("http://"+document.domain,"");
      //var $se = $( '#fixedaccordion a[href*="'+$url+'"]:last');
      //alert($se.length);
      //alert(ix);
      
      //if ( $( $( "#fixedaccordion" ).find("a")[ix] ).parent().hasClass('empty') || $( $( "#fixedaccordion" ).find("a")[ix] ).parent().hasClass('tools') || $( $( "#fixedaccordion" ).find("a")[ix] ).parent().hasClass('ui-accordion2-header'))
      if ($( '#fixedaccordion a[href*="'+$url+'"]:last').parent().hasClass('empty'))
           return false;
      else
           return true;
      }
    },
        active: false,  
        changestart: function(ev, ui) {
    if ($(ui.newContent).find('.empty').length > 0)    
    ui.disable();
    ev.preventDefault();
    ev.stopPropagation();
    }
  });
  
      $acc.find('.tools a').click(function(ev){
           ev.preventDefault();
           ev.stopPropagation();        
           document.location.href=ev.target;
          });

/*
      $acc.find('.ui-accordion2-header').each(function(){
  if ($('.empty').length > 0) {
    $(this).click(function(ev){
     document.location.href=ev.target;
     });
    }
  });
*/
       });
  
    $('.searchbutton').hover(function()
    {
      $(this).attr("src", "/images/rrc/icons/search_over.png");
    }, function() {
      $(this).attr("src", "/images/rrc/icons/search.png");
    });  
  
  
    $(function() {
      $("h3.menu").hover(
        function(){$(this).addClass("active")},
        function(){$(this).removeClass("active")});
       });
  
    $(function() {
      $(".newscontainer").hover(
        function(){$(this).addClass("activeround")},
        function(){$(this).removeClass("activeround")});
       });
  
      $(function() {
      $(".newsitem").click(
        
        function(ev){ if (ev.target.tagName != 'SPAN') { window.location=$(this).find(".newsurl").text()}});
      });  
  
    $(function() {
      $( "a, input:submit, button", ".ataglancebuttons,.coursebuttons,.pricebutton,.loginbutton,.submitbutton" ).button();
      $( "a, input:submit, button", ".ataglancebuttons,.coursebuttons,.pricebutton,.loginbutton,.submitbutton" ).click(function() { return true;  });
    });
  
    $('.slidecontent').hide();    

    $('.slidetoggle').click(function() {
      var ctx = $(this).parents(".coursesection");
      $('.slidecontent', ctx).slideToggle(400);
      $('.slidetoggle', ctx).toggleClass('small');
    return false;
  });
  
  /*
  $(function() {
    $('img[data-hover]').hover(function() {
        $(this).attr('tmp', $(this).attr('src')).attr('src', $(this).attr('data-hover')).attr('data-hover', $(this).attr('tmp')).removeAttr('tmp');
    }).each(function() {
        $('<img />').attr('src', $(this).attr('data-hover'));
    });;
});*/
  
    $('.twitter').hover(function()
    {
      $(this).attr("src", "/images/rrc/icons/twitter_over.png");
    }, function() {
      $(this).attr("src", "/images/rrc/icons/twitter.png");
    });   
  
    $('.facebook').hover(function()
    {
      $(this).attr("src", "/images/rrc/icons/facebook_over.png");
    }, function() {
      $(this).attr("src", "/images/rrc/icons/facebook.png");
    });    

    $('.linkedin').hover(function()
    {
      $(this).attr("src", "/images/rrc/icons/linkedin_over.png");
    }, function() {
      $(this).attr("src", "/images/rrc/icons/linkedin.png");
    });
  
    $('.youtube').hover(function()
    {
      $(this).attr("src", "/images/rrc/icons/youtube_over.png");
    }, function() {
      $(this).attr("src", "/images/rrc/icons/youtube.png");
    });  
  
    $('.cart').hover(function()
    {
      $(this).attr("src", "/images/rrc/icons/cart_over.png");
    }, function() {
      $(this).attr("src", "/images/rrc/icons/cart.png");
    });  
  

  $(function() {
      function addMega(){
        $(this).addClass("hovering");
        }

      function removeMega(){
        $(this).removeClass("hovering");
        }

    var megaConfig = {
         interval: 100,
         sensitivity: 4,
         over: addMega,
         timeout: 500,
         out: removeMega
    };

    $("li.menu").hoverIntent(megaConfig)   
  });
  
  $('.twitter-button').click(function (event){

      var url = $(this).attr("href");
      var windowName = "Twitter";//$(this).attr("name");
      var windowSize = "width=600,height=500,scrollbars=yes";

      window.open(url, windowName, windowSize);
      event.preventDefault();
           event.stopPropagation();  

  });  
  
  
});   



