/*jQuery.fn.mailme = function(test) {
    var at = / at /;
    var dot = / dot /g;
    this.each( function() {
        var addr = jQuery(this).text().replace(at,"@").replace(dot,".");
        var title = jQuery(this).attr('title')
        $(this)
            .after('<a href="mailto:'+addr+'" title="'+title+'" class="'+test+'">'+ addr +'</a>')
            .remove();
    });
};
/*/
$(document).ready(function(){
	// MASTERMINDS (ANYTHINGSLIDER)
	if($('#masterminds .slides .slide').length>1){
		$('#masterminds .slides > .slide').show();
		$('#masterminds .slides').anythingSlider({
			width               : 956,      // Override the default CSS width
			height              : 233,      // Override the default CSS height
			expand              : false,     // If true, the entire slider will expand to fit the parent element
			resizeContents      : false,      // If true, solitary images/objects in the panel will expand to fit the viewport
			showMultiple        : false,     // Set this value to a number and it will show that many slides at once
			tooltipClass        : 'tooltip', // Class added to navigation & start/stop button (text copied to title if it is hidden by a negative text indent)
			theme               : 'default', // Theme name - adds a class name to the base element "anythingSlider-{theme}" so the loaded theme will work.
			startPanel          : 1,         // This sets the initial panel
			changeBy            : 1,         // Amount to go forward or back when changing panels.
			hashTags            : false,      // Should links change the hashtag in the URL?
			infiniteSlides      : true,      // if false, the slider will not wrap
			enableKeyboard      : false,      // if false, keyboard arrow keys will not work for the current panel.
			buildArrows         : false,      // If true, builds the forwards and backwards buttons
			buildNavigation     : false,      // If true, builds a list of anchor links to link to each panel
			enableNavigation    : false,      // if false, navigation links will still be visible, but not clickable.
			toggleControls      : false,     // if true, slide in controls (navigation + play/stop button) on hover and slide change, hide @ other times
			appendControlsTo    : '',      // A HTML element (jQuery Object, selector or HTMLNode) to which the controls will be appended if not null
			enablePlay          : false,      // if false, the play/stop button will still be visible, but not clickable.
			autoPlay            : false,      // This turns off the entire slideshow FUNCTIONALY, not just if it starts running or not
			autoPlayLocked      : false,     // If true, user changing slides will not stop the slideshow
			startStopped        : false,     // If autoPlay is on, this can force it to start stopped
			pauseOnHover        : false,      // If true & the slideshow is active, the slideshow will pause on hover
			stopAtEnd           : false,     // If true & the slideshow is active, the slideshow will stop on the last page. This also stops the rewind effect when infiniteSlides is false.
			playRtl             : false,     // If true, the slideshow will move right-to-left
			delay               : 5000,      // How long between slideshow transitions in AutoPlay mode (in milliseconds)
			resumeDelay         : 0,     // Resume slideshow after user interaction, only if autoplayLocked is true (in milliseconds).
			animationTime       : 100,       // How long the slideshow transition takes (in milliseconds)
			easing              : "easeInOutExpo",   // Anything other than "linear" or "swing" requires the easing plugin
			maxOverallWidth     : 32766     // Max width (in pixels) of combined sliders (side-to-side); set to 32766 to prevent problems with Opera
		});		
		$("#masterminds .previous a").click(function(){
			$('#masterminds .slides').data('AnythingSlider').goBack(true);
			return false;
		});
		$("#masterminds .next a").click(function(){
			$('#masterminds .slides').data('AnythingSlider').goForward(true);
			return false;
		});	
	}

	
	// WEB DESIGN DETAILS (ANYTHINGSLIDER)
	if($('#webdesigndetails .slides figure').length>1){
		$('#webdesigndetails .bullet ul').remove();	
		$('#webdesigndetails .slides > figure').show();
		$('#webdesigndetails .slides').anythingSlider({
			width               : 960,      // Override the default CSS width
			height              : 490,      // Override the default CSS height
			expand              : false,     // If true, the entire slider will expand to fit the parent element
			resizeContents      : false,      // If true, solitary images/objects in the panel will expand to fit the viewport
			showMultiple        : false,     // Set this value to a number and it will show that many slides at once
			tooltipClass        : 'tooltip', // Class added to navigation & start/stop button (text copied to title if it is hidden by a negative text indent)
			theme               : 'default', // Theme name - adds a class name to the base element "anythingSlider-{theme}" so the loaded theme will work.
			startPanel          : 1,         // This sets the initial panel
			changeBy            : 1,         // Amount to go forward or back when changing panels.
			hashTags            : false,      // Should links change the hashtag in the URL?
			infiniteSlides      : true,      // if false, the slider will not wrap
			enableKeyboard      : false,      // if false, keyboard arrow keys will not work for the current panel.
			buildArrows         : false,      // If true, builds the forwards and backwards buttons
			buildNavigation     : true,      // If true, builds a list of anchor links to link to each panel
			enableNavigation    : true,      // if false, navigation links will still be visible, but not clickable.
			toggleControls      : false,     // if true, slide in controls (navigation + play/stop button) on hover and slide change, hide @ other times
			appendControlsTo    : $('#webdesigndetails .bullet'),      // A HTML element (jQuery Object, selector or HTMLNode) to which the controls will be appended if not null
			enablePlay          : false,      // if false, the play/stop button will still be visible, but not clickable.
			autoPlay            : true,      // This turns off the entire slideshow FUNCTIONALY, not just if it starts running or not
			autoPlayLocked      : true,     // If true, user changing slides will not stop the slideshow
			startStopped        : false,     // If autoPlay is on, this can force it to start stopped
			pauseOnHover        : true,      // If true & the slideshow is active, the slideshow will pause on hover
			stopAtEnd           : false,     // If true & the slideshow is active, the slideshow will stop on the last page. This also stops the rewind effect when infiniteSlides is false.
			playRtl             : false,     // If true, the slideshow will move right-to-left
			delay               : 5000,      // How long between slideshow transitions in AutoPlay mode (in milliseconds)
			resumeDelay         : 0,     // Resume slideshow after user interaction, only if autoplayLocked is true (in milliseconds).
			animationTime       : 1000,       // How long the slideshow transition takes (in milliseconds)
			easing              : "easeInOutExpo",   // Anything other than "linear" or "swing" requires the easing plugin
			maxOverallWidth     : 32766     // Max width (in pixels) of combined sliders (side-to-side); set to 32766 to prevent problems with Opera
		});		
		$("#webdesigndetails .previous a").click(function(){
			$('#webdesigndetails .slides').data('AnythingSlider').goBack(true);
			return false;
		});
		$("#webdesigndetails .next a").click(function(){
			$('#webdesigndetails .slides').data('AnythingSlider').goForward(true);
			return false;
		});	
	}
			
	// INDEX (ANYTHINGSLIDER)
	if($('#banner #slides aside').length>0){
		$('#banner .dots ul').remove();	
		$('#banner #slides > aside').show();
		$('#banner #slides').anythingSlider({
			width               : 960,      //1454// Override the default CSS width
			height              : 328,      // Override the default CSS height
			expand              : false,     // If true, the entire slider will expand to fit the parent element
			resizeContents      : false,      // If true, solitary images/objects in the panel will expand to fit the viewport
			showMultiple        : false,     // Set this value to a number and it will show that many slides at once
			theme               : 'default', // Theme name - adds a class name to the base element "anythingSlider-{theme}" so the loaded theme will work.
			startPanel          : 1,         // This sets the initial panel
			changeBy            : 1,         // Amount to go forward or back when changing panels.
			hashTags            : false,      // Should links change the hashtag in the URL?
			infiniteSlides      : true,      // if false, the slider will not wrap
			enableKeyboard      : false,      // if false, keyboard arrow keys will not work for the current panel.
			buildArrows         : false,      // If true, builds the forwards and backwards buttons
			buildNavigation     : true,      // If true, builds a list of anchor links to link to each panel
			enableNavigation    : true,      // if false, navigation links will still be visible, but not clickable.
			toggleControls      : false,     // if true, slide in controls (navigation + play/stop button) on hover and slide change, hide @ other times
			appendControlsTo    : $('#banner .dots'),      // A HTML element (jQuery Object, selector or HTMLNode) to which the controls will be appended if not null
			enablePlay          : false,      // if false, the play/stop button will still be visible, but not clickable.
			autoPlay            : true,      // This turns off the entire slideshow FUNCTIONALY, not just if it starts running or not
			autoPlayLocked      : false,     // If true, user changing slides will not stop the slideshow
			startStopped        : false,     // If autoPlay is on, this can force it to start stopped
			pauseOnHover        : true,      // If true & the slideshow is active, the slideshow will pause on hover
			stopAtEnd           : false,     // If true & the slideshow is active, the slideshow will stop on the last page. This also stops the rewind effect when infiniteSlides is false.
			playRtl             : false,     // If true, the slideshow will move right-to-left
			delay               : 10000,      // How long between slideshow transitions in AutoPlay mode (in milliseconds)
			resumeDelay         : 0,     // Resume slideshow after user interaction, only if autoplayLocked is true (in milliseconds).
			animationTime       : 1000,       // How long the slideshow transition takes (in milliseconds)
			easing              : "easeInOutExpo",   // Anything other than "linear" or "swing" requires the easing plugin
			maxOverallWidth     : 32766,     // Max width (in pixels) of combined sliders (side-to-side); set to 32766 to prevent problems with Opera			
			onSlideBegin        : function(event, slider){
				if(slider.$targetPage.text().indexOf("A New Way To Learn Language")!= -1)
				{
					$('#banner #boy').delay(1000).show().animate({left:346,opacity:1}, 1000, "easeInOutExpo");
				}
				else if(slider.$currentPage.text().indexOf("A New Way To Learn Language")!= -1)
				{
					$('#banner #boy').animate({left:0,opacity:0}, 1000, "easeInOutExpo", function()
					{
						$(this).hide();
					});
				}
			}
		});
		$('#banner #slides').anythingSliderFx({
			inFx : {
				'.slide1 h2' : { left : '0px', duration: 800, easing : 'easeOutExpo' },
				'.slide1 h3' : { left : '60px', top : '10px', duration: 1200, easing : 'easeOutBack' },
				'.slide2 h2' : { left : '0px', duration: 800, easing : 'easeOutExpo' },
				'.slide2 h3' : { left : '0px', duration: 1000, easing : 'easeOutExpo' },
				'.slide2 figure' : { top : '45px', duration: 1200, easing : 'easeOutExpo' },
				'.slide3 h2' : { left : '0px', duration: 800, easing : 'easeOutExpo' },
				'.slide3 figure' : { top : '0px', duration: 1000, easing : 'easeOutExpo' },
				'.slide3 h3' : { top : '0px', duration: 1200, easing : 'easeOutExpo' }
			},
			outFx : {
				'.slide1 h2' : { left : '1060px', duration: 1200, easing : 'easeOutExpo' },
				'.slide1 h3' : { left : '1060px', duration: 800, easing : 'easeOutExpo' },
				'.slide2 h2' : { left : '1060px', duration: 1200, easing : 'easeOutExpo' },
				'.slide2 h3' : { left : '1060px', duration: 1000, easing : 'easeOutExpo' },
				'.slide2 figure' : { top : '328px', duration: 800, easing : 'easeOutExpo' },
				'.slide3 h2' : { left : '1060px', duration: 1200, easing : 'easeOutExpo' },
				'.slide3 figure' : { top : '328px', duration: 1000, easing : 'easeOutExpo' },
				'.slide3 h3' : { top : '328px', duration: 800, easing : 'easeOutExpo' }
			}
		});
		$("#banner .previous a").click(function(){
			$('#banner #slides').data('AnythingSlider').goBack(true);
			return false;
		});
		$("#banner .next a").click(function(){
			$('#banner #slides').data('AnythingSlider').goForward(true);
			return false;
		});
	}
});
