$(document).ready(function(){
  $('.lightbox').click(function(){
    $("<div id='greyout'></div>").insertBefore('#tabs');	
    $('#greyout').fadeIn('fast');
    $("<div id='login'><a href='#' class='lightbox'><img id='applybutton' src='http://test.rlturner.com/images/button-apply.png' /></a><a id='loginbutton' href='https://rlturner.earthwing.net/PDMHost/Login/Login.aspx?p1=1&p2=1&returnurl=http%3a%2f%2frlturner.earthwing.net%2fpdmsubtheme%2fDefault.aspx%3frouting%3dExternal%26portalid%3dDE998109-7C5D-4E0E-8DCB-FCB4FCF569C8' class='lightbox'><img src='http://test.rlturner.com/images/button-login.png' /></a></div>").insertAfter('#greyout');
    $('#login').fadeIn('normal');
        
    $('#greyout').click(function(){
      $('#login').fadeOut('fast');
      $('#greyout').fadeOut('fast');
    });
		
    $x = $('#login').css('width').split('px')[0];
    $width = $(window).width();
	
    $y = $('#login').css('height').split('px')[0];
    $height = $(window).height();
		
    $left = ($width-$x)/2;
				
    $top = ($height-$y)/2;
				
    $('#login').css('top',$top+'px');
    $('#login').css('left',$left+'px');
  });

  
  var galleries = $('.ad-gallery').adGallery();
  $('#switch-effect').change(
    function() {
    galleries[0].settings.effect = $(this).val();
    return false;
  });
    
  $('#toggle-slideshow').click(
      function() {
        galleries[0].slideshow.toggle();
        return false;
      }
  );
  

  //$('#sidebar UL.navigation UL').hide();
  
  //$('#sidebar UL.navigation .has_children>a').click(function(e) {
      //e.preventDefault();
      //$(this).next('UL').slideToggle('normal');
      //$html = $(this).parent().find('.arrow').html();    
      //if (  $html == "∨"  )
        //$(this).parent().find('.arrow').html("&and;");
      //else
      //$(this).parent().find('.arrow').html("&or;");
    
  //});
    
  $('.navigation').accordion({header: 'li.has_children>a', navigation: true, collapsible: true, active: true, autoHeight: false});  
  
      
 
  $('#sidebar .has_children').prepend("<span class='arrow'>&or;</span>");

  $("#background img").fullBg();
  

	
  $('#testimonials').cycle();
  
  $('a.more').click(function(e) {
  e.PreventDefault;
  $('.details').toggle();
});

});
