jQuery(document).ready(function(){
	
	// tool tips
	$("#dropdown a[title]").tooltip();
	$(".curriculum a[title]").tooltip();
	
	// carousel
	$(window).bind("load", function() { 
	    $("div#promo-slide").slideViewerPro({ 
	        galBorderWidth: 0,  // the border width around the main images 
	        thumbsTopMargin: 15, // the distance that separates the thumbnails and the buttons from the main images 
	        thumbsRightMargin: 10, // the distance of each thumnail respect to the next one 
	        thumbsBorderWidth: 5, // the border width of each thumbnail. Note that the border in reality is above, not around 
	        buttonsWidth: 20, // the width of the prev/next buttons that commands the thumbnails 
	        galBorderColor: "#ffffff", // the border color around the main images 
	        thumbsBorderColor: "#ffffff", // the border color of the thumbnails but not the current one 
	        thumbsActiveBorderColor: "#b64426", // the border color of the current thumbnail 
	        buttonsTextColor: "#b64426", //the color of the optional text in leftButtonInner/rightButtonInner 
	        thumbsBorderOpacity: 0, // could be 0, 0.1 up to 1.0 
	        thumbsActiveBorderOpacity: 1.0, // could be 0, 0.1 up to 1.0 
	        easeTime: 750, // the time it takes a slide to move to its position 
	        asTimer: 6000, // if autoslide is true, this is the interval between each slide 
	        thumbs: 3, // the number of visible thumbnails 
	        thumbsPercentReduction: 25, // the percentual reduction of the thumbnails in relation to the original 
	        thumbsVis: true, // with this option set to false, the whole UI (thumbs and buttons) are not visible 
	        leftButtonInner: "&larr;", //could be an image "<img src='images/larw.gif' />" or an escaped char as "&larr"; 
	        rightButtonInner: "&rarr;", //could be an image or an escaped char as "&rarr"; 
	        autoslide: true, // by default the slider do not slides automatically. When set to true REQUIRES the jquery.timers plugin 
	        typo: false, // the typographic info of each slide. When set to true, the ALT tag content is displayed 
	        typoFullOpacity: 0.9, // the opacity for typographic info. 1 means fully visible. 
	        shuffle: false // the LI items can be shuffled (randomly mixed) when shuffle is true 
	    }); 
	});
		
	// campaign monitor form
	//$('#otjkrj-otjkrj').focus(function(){
	//	$(this).val('');
	// });
	//$('#otjkrj-otjkrj').blur(function(){
	 	//$(this).val('your email. our newsletter.');
	 //});
	 jQuery('#otjkrj-otjkrj').focus(function(){
	 	jQuery(this).val('');
	  });
	  jQuery('#otjkrj-otjkrj').blur(function(){
	  	jQuery(this).val('your email. our newsletter. (type and hit "enter")');
	   });
	$('#enews').hover(function(){
	  	$('#newsletter').css('display', 'block');
	  	},
	  	function(){
	  	$('#newsletter').css('display', 'none');
	 });
	
	function checkEmail(email) { 
	  var pattern = /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	  var emailVal = $("#" + email).val();
	  return pattern.test(emailVal);
	}
	
	$(function() {
	  $("#subForm input").keypress(function(e) { 
	    if(e.which == 13){ 
	    
	    // First, disable the form from submitting
	    $('form#subForm').submit(function() { return false; });
	    
	    // Grab form action
	    var formAction = $("form#subForm").attr("action");
	    
	    // Hacking together id for email field
	    // Replace the xxxxx below:
	    // If your form action were http://mysiteaddress.createsend.com/t/r/s/abcde/, then you'd enter "abcde" below
	    var id = "otjkrj";
	    var emailId = id + "-" + id;
	    
	    // Validate email address with regex
	    if (!checkEmail(emailId)) {
	      alert("Please enter a valid email address");
	      return;
	    }
	    
	    // Serialize form values to be submitted with POST
	    var str = $("form#subForm").serialize();
	    
	    // Add form action to end of serialized data
	    // CDATA is used to avoid validation errors
	    //<![CDATA[
	    var serialized = str + "&action=" + formAction;
	    // ]]>
	    
	    // Submit the form via ajax
	    $.ajax({
	      url: "http://media.boundlessyoga.com/proxy.php",
	      type: "POST",
	      data: serialized,
	      success: function(data){
	        // Server-side validation
	        if (data.search(/invalid/i) != -1) {
	          alert('The email address you supplied is invalid and needs to be fixed before you can subscribe to this list.');
	        }
	        else
	        {
	          $("#theForm").hide(); // If successfully submitted hides the form
	          $("#confirmation").slideDown("slow");  // Shows "Thanks for subscribing" div
	          $("#confirmation").tabIndex = -1;
	          $("#confirmation").focus(); // For screen reader accessibility
	          // Fire off Google Analytics fake pageview
	          //var pageTracker = _gat._getTracker("UA-XXXXX-X");
	          //pageTracker._trackPageview("/newsletter_signup");
	        }
	      }
	    });
	    }
	  });
	});
	
	
});

