$(document).ready(function() {
  $('#container').find('a.window_link').click(function() {
  	window.open(this.href);
  	return false;
  });

  $('#container').find('a.confirm_link').click(function() {
  	return confirm('Are you sure you wish to proceed?');
  });
  
  $("input.remove_default").bind('click', function(e) {
  	$(this).val('');
  });

  if ($(':input:first').attr('id') == 'search-keyword') {
  	$("#search-form :input:first").focus();
  } else {
  	$(':input:first').focus();
  }
  
  /*$("#product_list").accordion();*/
  
  $('.products_holder').each(function(i,e) {
	  if (i > 0) $(this).hide();
  });
  
  $('a.product_link_selector').click(function() {
	 var holderid = this.id;
	 holder = holderid.replace(/_selector/, '');
	 
	 $('#product_gloves_bg').attr('class', 'product_bg_' + holder);

	 $('ul#product_selector li').removeClass('onstate');
	 
	 $('.products_holder').each(function(i,e) {
		 if (e.id == 'product_'+holder) {
			$(this).show(); 
			$('li.'+holderid).addClass('onstate');
		 } else {
			$(this).hide(); 
		 }
	 });
	 
	 return false;
  });
  
  $('#product_childrens_gloves').hide();
  $('#product_ladies_gloves').hide();
  $('#product_mens_gloves').hide();
  var sel_cat = $('#cat-selected').text();
  $('#product_'+sel_cat).show();

  $('textarea fck').fck({
      config: {
              CustomConfigurationsPath: '../../admin/js/fckeditor.toolbars.js?' + ( new
	Date() * 1 ),
	StylesXmlPath: '../../admin/css/fckeditor.xml',
	ImageUpload: false,
	FormatOutput: true
	},  
	toolbar: 'Custom',
	      height: 300
	});
	
	
	$('#heard_from').bind('change', function(e) {
	  var field_ref = this.value;
	  
	  if (field_ref == 'Other (please state below)') {
	  	$("#heard_from_other").attr('disabled', false);
		  $("#heard_from_other").show();
	  } else {
	  	$("#heard_from_other").attr('disabled', true);
		  $("#heard_from_other").hide();
	  }
	});

  
  $('a.lightbox').lightBox();
});