$(document).ready(function() {
	
	/* mailing list clear on click 	
		var queryTerm = $("#email-newsletter").val();
		
	$("#email-newsletter").click(function() {
		if($(this).val() == queryTerm){
			$(this).val('')
		}	
	});	
	$("#email-newsletter").blur(function() {
		if($(this).val() == ''){
			$(this).val(queryTerm)
		}	
	});*/

	function placeholder(){  
		$("#email-newsletter, input[type=text]").each(function(){  
			var phvalue = $(this).attr("placeholder");  
			$(this).val(phvalue);  
		});  
	}  
	placeholder();  
	$("#email-newsletter, input[type=text]").focusin(function(){  
		var phvalue = $(this).attr("placeholder");  
		if (phvalue == $(this).val()) {  
			$(this).val("");  
		}  
	});  
	$("#email-newsletter, input[type=text]").focusout(function(){  
		var phvalue = $(this).attr("placeholder");  
		if ($(this).val() == "") {  
			$(this).val(phvalue);  
		}  
	});
	
	/* top banner slider */
    $('#banner ul').bxSlider({	
		mode: 'fade',									// 'horizontal', 'vertical', 'fade'
		infiniteLoop: true,									// true, false - display first slide after last
		hideControlOnEnd: true,						// true, false - if true, will hide 'next' control on last slide and 'prev' control on first
		controls: false,											// true, false - previous and next controls
		speed: 6000,													// integer - in ms, duration of time slide transitions will occupy
		easing: 'swing',                    // used with jquery.easing.1.3.js - see http://gsgd.co.uk/sandbox/jquery/easing/ for available options
		pager: false,												// true / false - display a pager
		pagerSelector: null,								// jQuery selector - element to contain the pager. ex: '#pager'
		pagerType: 'full',									// 'full', 'short' - if 'full' pager displays 1,2,3... if 'short' pager displays 1 / 4
		pagerLocation: 'bottom',						// 'bottom', 'top' - location of pager
		pagerShortSeparator: '/',						// string - ex: 'of' pager would display 1 of 4
		pagerActiveClass: 'pager-active',		// string - classname attached to the active pager link
		nextText: 'next',										// string - text displayed for 'next' control
		nextImage: '',											// string - filepath of image used for 'next' control. ex: 'images/next.jpg'
		nextSelector: null,									// jQuery selector - element to contain the next control. ex: '#next'
		prevText: 'prev',										// string - text displayed for 'previous' control
		prevImage: '',											// string - filepath of image used for 'previous' control. ex: 'images/prev.jpg'
		prevSelector: null,									// jQuery selector - element to contain the previous control. ex: '#next'
		captions: false,										// true, false - display image captions (reads the image 'title' tag)
		captionsSelector: null,							// jQuery selector - element to contain the captions. ex: '#captions'
		auto: true,												// true, false - make slideshow change automatically
		autoDirection: 'next',							// 'next', 'prev' - direction in which auto show will traverse
		autoControls: false,								// true, false - show 'start' and 'stop' controls for auto show
		autoControlsSelector: null,					// jQuery selector - element to contain the auto controls. ex: '#auto-controls'
		autoStart: true,										// true, false - if false show will wait for 'start' control to activate
		autoHover: false,										// true, false - if true show will pause on mouseover
		autoDelay: 0,                       // integer - in ms, the amount of time before starting the auto show
		pause: 6000,												// integer - in ms, the duration between each slide transition
		startText: 'start',									// string - text displayed for 'start' control
		startImage: '',											// string - filepath of image used for 'start' control. ex: 'images/start.jpg'
		stopText: 'stop',										// string - text displayed for 'stop' control
		stopImage: '',											// string - filepath of image used for 'stop' control. ex: 'images/stop.jpg'
		ticker: false,											// true, false - continuous motion ticker mode (think news ticker)
																				// note: autoControls, autoControlsSelector, and autoHover apply to ticker!
		tickerSpeed: 5000,								  // float - use value between 1 and 5000 to determine ticker speed - the smaller the value the faster the ticker speed
		tickerDirection: 'next',						// 'next', 'prev' - direction in which ticker show will traverse
		tickerHover: false,                 // true, false - if true ticker will pause on mouseover
		wrapperClass: 'banner-slider-wrapper',					// string - classname attached to the slider wraper
		startingSlide: 0, 									// integer - show will start on specified slide. note: slides are zero based!
		displaySlideQty: 1,									// integer - number of slides to display at once
		moveSlideQty: 1,										// integer - number of slides to move at once
		randomStart: false,									// true, false - if true show will start on a random slide
	});
	
	/* home slider */
    $('#inc-slider').bxSlider({	
		mode: 'vertical',                 // 'horizontal', 'vertical', 'fade'
		infiniteLoop: true,                 // true, false - display first slide after last
		hideControlOnEnd: true,            // true, false - if true, will hide 'next' control on last slide and 'prev' control on first
		controls: false,                     // true, false - previous and next controls
		speed: 500,                         // integer - in ms, duration of time slide transitions will occupy
		pager: true,                        // true / false - display a pager
		pagerSelector: null,                // jQuery selector - element to contain the pager. ex: '#pager'
		pagerType: 'full',                  // 'full', 'short' - if 'full' pager displays 1,2,3... if 'short' pager displays 1 / 4
		pagerLocation: 'bottom',            // 'bottom', 'top' - location of pager
		pagerShortSeparator: '/',           // string - ex: 'of' pager would display 1 of 4
		pagerActiveClass: 'pager-active',   // string - classname attached to the active pager link
		nextText: '',                   // string - text displayed for 'next' control
		nextImage: '',                      // string - filepath of image used for 'next' control. ex: 'images/next.jpg'
		nextSelector: null,                 // jQuery selector - element to contain the next control. ex: '#next'
		prevText: '',                   // string - text displayed for 'previous' control
		prevImage: '',                      // string - filepath of image used for 'previous' control. ex: 'images/prev.jpg'
		prevSelector: null,                 // jQuery selector - element to contain the previous control. ex: '#next'
		captions: false,                    // true, false - display image captions (reads the image 'title' tag)
		captionsSelector: null,             // jQuery selector - element to contain the captions. ex: '#captions'
		auto: false,                        // true, false - make slideshow change automatically
		autoDirection: 'next',              // 'next', 'prev' - direction in which auto show will traverse
		autoControls: false,                // true, false - show 'start' and 'stop' controls for auto show
		autoControlsSelector: null,         // jQuery selector - element to contain the auto controls. ex: '#auto-controls'
		autoStart: true,                    // true, false - if false show will wait for 'start' control to activate
		autoHover: false,                   // true, false - if true show will pause on mouseover
		pause: 3000,                        // integer - in ms, the duration between each slide transition
		startText: 'start',                 // string - text displayed for 'start' control
		startImage: '',                     // string - filepath of image used for 'start' control. ex: 'images/start.jpg'
		stopText: 'stop',                   // string - text displayed for 'stop' control
		stopImage: '',                      // string - filepath of image used for 'stop' control. ex: 'images/stop.jpg'
		ticker: false,                      // true, false - continuous motion ticker mode (think news ticker)
											// note: autoControls, autoControlsSelector, and autoHover apply to ticker!
		tickerSpeed: 5000,                  // integer - has an inverse effect on speed. therefore, a value of 10000 will 
											// scroll very slowly while a value of 50 will scroll very quickly.
		tickerDirection: 'next',            // 'next', 'prev' - direction in which ticker show will traverse
		wrapperClass: 'inc-slider-wrapper',         // string - classname attached to the slider wraper
		startingSlide: 0,                   // integer - show will start on specified slide. note: slides are zero based!
		displaySlideQty: 1,                 // integer - number of slides to display at once
		moveSlideQty: 1,                    // integer - number of slides to move at once
		randomStart: false                 // true, false - if true show will start on a random slide
	});
	
	/* inc partners */
	$('.inc-carousel').bxCarousel({
		display_num: 4,
		move: 2,
		prev_image: '/images/layout/arrow_left.png',
		next_image: '/images/layout/arrow_right.png',
		margin: 10
	});
	
	/* inc picvid */
	$('.inc-c-picvid').bxCarousel({
		display_num: 4,
		move: 2,
		prev_image: '/images/layout/arrow_left.png',
		next_image: '/images/layout/arrow_right.png',
		margin: 4
	});
	
	$('.viewport_vid').click(function(e){
		e.preventDefault();
		$this = $(this);
		if ($this.children(".transloadit").length > 0) {
			$('#artist_media_container').html($this.children("input.transloadit").val())
			flowplayer($this.children("input.transloadit_player_id").val(), "/themes/third_party/transloadit/flowplayer/flowplayer-3.2.5.swf");
			
		}
		else {
			$('#artist_media_container').html($this.children("input").val());
		}
	
	});
	
	$('.viewport_pic').click(function(e){
		e.preventDefault();
		var pic_embed_url = $(this).attr("href");
		var pic_embed_alt = $(this).children("img").attr("alt");
		
		var pic_embed_tag = '<img alt="' + pic_embed_alt + '" src="' + pic_embed_url + '" />';
		
		$('#artist_media_container').html(pic_embed_tag);
	});
	
	/* artist detail page contact form drop */
	$('.artist-contact-form').hide();
	
	$('.communiquer').click(function(e){
		e.preventDefault();
				
		$('.artist-contact-form').slideToggle("slow");
	});	
	
});
