  $(document).ready(function(){
  
  $( ".datepicker" ).datepicker({
	  onstrainInput: true,
	  dateFormat: 'dd/mm/yy'
   });

  Cufon.replace('.cufon');
  
  //COLORBOX FOR SCREENSHOTS and OTHER POPUP IMAGES
  $('a.screenshot').colorbox({rel:'screenshots', photo: 'true'});
  //THE SCRIPT BELOW FORCES a href="#" not toe go to the top of the page
  $('a[href=#]').click(function(){
  return false;
  });
  
  //SCROLL TO TOP FOR ALL a href="#top"
  $('a[href=#top]').click(function(){
      $('html').animate({scrollTop:0}, 'slow');
      return false;
      });


  //START REQUEST QUOTE/DEMO FUNCTIONS
  $('.switch_tab').click(function(){
  $('#request_quote_top_holder').toggle();
  $('#request_demo_top_holder').toggle();
  $('.switch_tab#demo').toggle();
  $('.switch_tab#quote').toggle();
  });

  //START REQUEST QUOTE/DEMO FUNCTIONS FOR HOME PAGE
  $('.request_holder a.tab').click(function(){
	  if($(this).hasClass('selected')){
	      return false;
	  }else{ 
	      var OldID =$('.request_holder a.tab.selected').attr("id");
	      var OldID ='request_'+OldID;
	      $('.request_holder a.tab.selected').removeClass('selected');
	      $(this).addClass('selected');
	      var TheID = $(this).attr("id");
	      var TheID = 'request_'+TheID;
	      $('.request_holder #'+OldID).fadeOut(function(){
		      $('.request_holder #'+TheID).fadeIn();
		  });
	      
	  }
      });
  

  $('.faq > h6').click(function(){
    if($(this).parent().hasClass('open')){
      $(this).parent().removeClass('open');
    }else{
      $('.faq.open').removeClass('open');
      $(this).parent().addClass('open');
    }
  });
  $('.feature > h6').click(function(){
    if($(this).parent().hasClass('open')){
      $(this).parent().removeClass('open');
    }else{
      $('.feature.open').removeClass('open');
      $(this).parent().addClass('open');
    }
  });
  $('.left_oneninety .menu a').click(function(){
    var theShow = $(this).attr('id');
    $('.feature_group').hide();
    $('.feature_group.'+theShow).show();
    $('.left_oneninety .menu a.selected').removeClass('selected');
    $(this).addClass('selected');
  });
  //MAIN NAV - SET LAST CLASS ON LAST LI - REVERSED DUE TO FLOAT : RIGHT 
  $('ul#nav li:first-child').addClass('last');
  //REMOVE LAST CLASS FROM FIRST DROPDWON MENU
  $('ul#nav li ul li:first-child').removeAttr('class');
  $('ul#nav li ul li:last-child a').addClass('last');
  //FOOTER NAV - SET FIRST CLASS ON FIRST LI
  $('.main_footer ul li:first-child a').addClass('first');
  //white curved boxes - set last row to have no border
  $('.white_box .middle .row:last-child').addClass('last');
  //left menu
  $('.left_menu .menu ul li:last-child').addClass('last');
  //key features
  $('.left_content .column .seperated:last-child').addClass('last');
  
  });
