jQuery('html').addClass('json');

// true if IE
var IE = /*@cc_on!@*/false;

var lddCMS = {
		
	load : function() {
		lddCMS.coreFunctions();
		if (jQuery('.carousel')[0]){ lddCMS.carousel();};
		if (jQuery('ul#services')[0]){ lddCMS.accordian();};
		lddCMS.fancybox();
	},
	
	
	

	
	coreFunctions : function(){
		
		jQuery('.widget_ns_mailchimp h3').html('Sign up to our <span>mailing list</span>');
		jQuery('#ns_widget_mailchimp-email-4').val('Enter your email address...').addClass('textinput');
		jQuery('.widget_ns_mailchimp label').html('Enter your email address');
		
		
		jQuery('.post-1083 .entry-content').css('height', '0').css('overflow', 'hidden');
		jQuery('#post-1083').prepend('<h1 class="freedownloadsnote">Free Downloads</h2><h2 class="freedownloadsnote">Sign up to our mailing list by filling in the box on the left hand side to reveal all of the free downloads</h2>');
		
		
		jQuery('.textinput').focus(function() {
			jQuery('.textinput').each(function(){ if (jQuery(this).attr('value')==''){  jQuery(this).attr('value', 'Enter your ' + jQuery(this).attr('id').replace(/_/gi,' ')+'...');  } });
			if (this.value.substr(this.value.length-3,3) == '...') {this.value=''; }
		});
		jQuery('.textinput').blur(function() {
			if (jQuery(this).attr('value')==''){ jQuery(this).attr('value', jQuery(this).parent().find('label').html()+'...');}
		});
		
		
		jQuery('.widget_shopping_cart p.total strong').remove();
		currentBasketPrice = jQuery('.widget_shopping_cart p.total').html();
		if (jQuery('.widget_shopping_cart p.total')[0]){ jQuery('#cart .desc').html(currentBasketPrice); };
		
		jQuery('.bookartistbtn').click(function(){
			artistName = jQuery('h1.lesserMargin').html();
			jQuery.cookie('artistName', artistName, { expires: 365, path: '/' });
		});
		
		artistsRetrieved = jQuery.cookie('artistName');
		jQuery('.page-id-343 .iwacontact .formitem:first-child input').val(artistsRetrieved);
		
		
		jQuery('.widget_ns_mailchimp input[type=text]').wrap('<div class="inputholder" />');
		
		
	},
		
	
	carousel : function(){
		var autoscrolling = true;
		jQuery('.carousel').infiniteCarousel().mouseover(function () {
			autoscrolling = false;
		}).mouseout(function () {
			autoscrolling = true;
		});
		setInterval(function () {
			if (autoscrolling) {
				jQuery('.carousel').trigger('next');
			}
		}, 4000);
	},
	
	fancybox : function(){
		 jQuery("a.viewlarger").fancybox({
				'speedIn':		300,
				'speedOut':	300,
				'overlayColor':	'#000',
				'overlayOpacity':	0.7
		 });
	 }
	 
}



jQuery(document).ready(lddCMS.load);
