$(document).ready(function(){
  $(document).pngFix();
  
  $('.lb').lightBox(); // lightbox

  // external link:
  function externalLinks(base_url) {
    return $('a[href^=http]:not("[href^=' + base_url + ']"):not(":has(\'img\')")');
  }
  
  externalLinks('this.hostname').addClass("external");
   
  $('.external').click(function(){
  this.target = "_blank";
  });
  
  // carousel
  if($(".carousel").length) {
    $(".carousel").jCarouselLite({
      auto: 1200,
      speed: 2200,
      visible: 1
    });    
  }
  
  if($(".carouselcontrols").length) {
    $(".carouselcontrols").jCarouselLite({
      // auto: 1200,
      // speed: 2200,
      visible: 1,
      btnNext: ".next",
      btnPrev: ".prev"
    });    
  }
  
  // toggle groups of templates
  if($('.template_group').length) {
    $('.template_group').toggle();
    $('.showgroup').click(function(e){
      $(this).children('.template_group').slideToggle("slow");
    });    
  }
  
  // Deal with the select data by using the radios to populate the selects on createwebsite template choice
  if($('#id_template').length) {
    $('#id_template').hide()
    $('#createsubmit').click(function(){
      $('#templategroups input:radio').val();
      var value = $('#templategroups input:radio').val();
      $('id_template input:option').val(value);
    });    
  }
  
  // Add ons
  // $('.hide-form').hide();
  // $('#create li input').hide();
  // alert($('#create add_ons_new').val());
  
  // NEW feature list
	$.featureList(
		$("#tabs li a"),
		$("#output li"), {
			start_item	:	1
		}
	);

	/*
	
	// Alternative

	
	$('#tabs li a').featureList({
		output			:	'#output li',
		start_item		:	1
	});

	*/
  
  
});
