$(document).ready(function(){ 


/* Slider */
	$(".scroll").scrollable({
		size: 1, 
		clickable: false,
		onLoad: function() { 
        	onBeforeSeek(function() { return false; }); // disables autoscroll 
		},
		onClose: function() { 
        	unbind("onBeforeSeek"); // reenables autoscroll 
		} 
		})
	.circular().autoscroll({ 
		steps: 1, 
		interval: 5000,
		autopause: true
	});

/* Tabs */
$("ul.newstabsnav").tabs("div.newstabs > div",{ current: 'selected'});

/* Labelify */
	$("body.searchresultsPage #search .input").removeAttr('title');
	$("#search .input, #mailinglist #txtEmailAddress, #questionform .input").labelify();

/* FAQ */
	$("#faq dd, #toptips dd").append('<br />&nbsp;').hide ();
	$("#faq dt, #toptips dt").prepend('<img src="/media/images/arrow.png" alt="" class="faqarrow" /><span>More Info</span>');
	$("#faq dt:first-child, #toptips dt:first-child").css("background","none")
	$("#faq dt span, #toptips dt span").click(function () {
		$('#faq dd:visible, #toptips dd:visible').slideUp('fast');
        $(this).parent().next('#faq dd, #toptips dd').slideDown('fast');
		$('#faq dd:visible, #toptips dd:visible').prev().toggleClass('nospan');
    });

/* Stockist Map */
	$('h3#showmap').hide();
	$("h3.mapToggle").click(function () {
    	$("#stockAll").slideToggle("slow");
	});
	$("h3#showmap").click(function () {
		$(this).hide();
		$("h3#hidemap").show();					  
	});
	$("h3#hidemap").click(function () {
		$(this).hide();
		$("h3#showmap").show();					  
	});

/* Form Focus */
  $('#contactForm input[type="text"], #contactForm textarea').addClass("defaultField"); 
  $('#contactForm input[type="text"], #contactForm textarea').focus(function() { 
    $(this).removeClass("defaultField").addClass("selectedField"); 
    if (this.value == this.defaultValue){ 
      this.value = ''; 
    } 
    if(this.value != this.defaultValue){ 
      this.select(); 
    } 
  }); 
  $('#contactForm input[type="text"], #contactForm textarea').blur(function() { 
    $(this).removeClass("selectedField").addClass("defaultField"); 
    if ($.trim(this.value == '')){ 
      this.value = (this.defaultValue ? this.defaultValue : ''); 
      } 
    }); 
  
/* Misc */
	// Add alternate table rows */
	$('#stockistsList tbody tr:odd').addClass('alt');
	// last class for news archive
	$(".newsarchive .item:last").addClass('last');
	
/* Home Page SEO Text */
	$('#homecontent .text').hide();
	$('#homecontent #introtext').toggle(function() {
		$(this).addClass('close');
		$('#homecontent .text').slideDown();
	}, function() {
		$(this).removeClass('close');
		$('#homecontent .text').slideUp();
	});	

	$("#wheretobuy a.idealworldReadmore").hover(function () {
    	$('#idealWorldPopup').slideDown();
  	}, 
  	function () {
    	$('#idealWorldPopup').slideUp();
  	});




});

