/* 
 * SnowValley Core JavaScript
 */
 


 // This is the required configuration to work with ASP.NET JSON Web methods, 
 // plus a handler for server side exceptions received by AJAX. The handler 
 // can be overriden in site specific scripts to do something a little more presentable

 $.ajaxSetup({ // Deftault AJAX setup for .NET JSON Methods
     type: "POST",
     contentType: "application/json; charset=utf-8",
     dataType: "json",
     error: function(xhr, textStatus, errorThrown) {
       var responseJSON = JSON.parse( xhr.responseText );
       var message = xhr.statusText + ': ' + (responseJSON.Message || "" );
       alert(message);
     }
 });


 /*
  * JSON2 
  * Propvides JSON.stringify and JSON.parse methods
  * http://www.JSON.org/js.html
  */

var JSON=JSON||{};(function(){function f(n){return n<10?"0"+n:n}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf()}}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==="string"?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+string+'"'}function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==="object"&&typeof value.toJSON==="function"){value=value.toJSON(key)}if(typeof rep==="function"){value=rep.call(holder,key,value)}switch(typeof value){case"string":return quote(value);case"number":return isFinite(value)?String(value):"null";case"boolean":case"null":return String(value);case"object":if(!value){return"null"}gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==="[object Array]"){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||"null"}v=partial.length===0?"[]":gap?"[\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"]":"["+partial.join(",")+"]";gap=mind;return v}if(rep&&typeof rep==="object"){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==="string"){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}v=partial.length===0?"{}":gap?"{\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"}":"{"+partial.join(",")+"}";gap=mind;return v}}if(typeof JSON.stringify!=="function"){JSON.stringify=function(value,replacer,space){var i;gap="";indent="";if(typeof space==="number"){for(i=0;i<space;i+=1){indent+=" "}}else{if(typeof space==="string"){indent=space}}rep=replacer;if(replacer&&typeof replacer!=="function"&&(typeof replacer!=="object"||typeof replacer.length!=="number")){throw new Error("JSON.stringify")}return str("",{"":value})}}if(typeof JSON.parse!=="function"){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==="object"){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v}else{delete value[k]}}}}return reviver.call(holder,key,value)}cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){j=eval("("+text+")");return typeof reviver==="function"?walk({"":j},""):j}throw new SyntaxError("JSON.parse")}}}());



/*
 * numericUpDown 
 * Provide increment and decrement buttons for a numeric textfield
 * 
 */

 
$.fn.numericUpDown = function(settings) {
   var settings = jQuery.extend({}, $.fn.numericUpDown.defaultSettings, settings); // import default settings, and override with any supplied settings

   return this.each(function() {
     
     if ( $(this).data('sv-numericUpDown') ) {
       return;
     };
     
     // save a reference to the textfield being modified
     var textfield = $(this)
                     .data('step', settings.step)
                     .data('sv-numericUpDown', {
                       initialised: true, // flag this element as intialised, so it won't be initialised again
                       step: settings.step
                     }); 

                     
    // disable textField if required
    if (settings.disableTextfield === true) {
      $(textfield).attr('readonly', 'readonly');
    }

     // create the control buttons
     var incrementButton = $('<a />')
                           .text(settings.incrementText)
                           .attr(settings.incrementAttributes)
                           .click(function(e) {
                             e.preventDefault();
                             $.fn.numericUpDown.increment.apply(textfield, [settings.step, settings.maxValue]);
                             return false; 
                           });
                           
     var decrementButton = $('<a />')
                           .text(settings.decrementText)
                           .attr(settings.decrementAttributes)
                           .click(function(e) {
                             e.preventDefault();
                             $.fn.numericUpDown.decrement.apply(textfield, [settings.step, settings.minValue]);
                             return false;
                           });

     
     // add to them either side of the textfield
     $(textfield).after(incrementButton);
     $(textfield).before(decrementButton);
     
   });
 };
 
$.fn.numericUpDown.defaultSettings = { 
  incrementText: '+',
  incrementAttributes: {
    'class': 'sv-increment',
    'href': '#',
    title: 'Increment'
  },
  decrementText: '-',
  decrementAttributes: {
    'class': 'sv-decrement',
    'href': '#',
    title: 'Decrement'
  },
  disableTextfield: false, // should we prevent the user from interacting with the textfield?
  step: 1,                  // value to increment/decrement by,
  maxValue: false           // a maximum amount the field can increase to (false for no maximum)
};
 
$.fn.numericUpDown.increment = function(amount, maxValue) {
  var newValue =  parseInt( $(this).val(), 10) + parseInt(amount, 10);
  
  
  if (maxValue && maxValue < newValue) {
    return;
  };
  $(this).val( newValue ).trigger('change');  
  
};

$.fn.numericUpDown.decrement = function(amount, minValue) {
  minValue = minValue || 0;
  var newValue =  parseInt( $(this).val(), 10) - parseInt(amount, 10);
  
  if ( newValue < minValue ) { 
    return false; 
  }
  
  $(this).val( parseInt( $(this).val(), 10) - amount )
         .trigger('change');

};

/*
 * linkButton 
 * Show anchors in place of input buttons, and pass through click from anchor to input button
 * 
 */

(function($) {

  $.fn.linkButton = function() {
    return this.each(function() {
      var btn = this;
    
      $(btn).removeClass("link-button"); // prevent script from running again on this element

      $("<a/>").attr( { href : '#',
                        title: btn.alt || btn.title,
                        'class': btn.className } )
                .append( this.value )
                .bind( "click.sv-linkButton", function() {
                          btn.click();
                          return false; 
                        })
                .insertBefore(this);

      $(this).hide();
      
    });
  };
  
})(jQuery);


/* idTabs ~ Sean Catchpole - Version 2.2 - MIT/GPL */ 
/* Modified to remove auto-loading jQuery library [MSS] */
/* Modified so selected class is added to anchor and its parent [DAB]*/

(function(){ 

var init = function(){  
 
/* Options (in any order): 
 
 start (number|string) 
    Index number of default tab. ex: $(...).idTabs(0) 
    String of id of default tab. ex: $(...).idTabs("tab1") 
    default: class "selected" or index 0 
    Passing null will force it to not select a default tab 
 
 change (boolean) 
    True - Url will change. ex: $(...).idTabs(true) 
    False - Url will not change. ex: $(...).idTabs(false) 
    default: false 
 
 click (function) 
    Function will be called when a tab is clicked. ex: $(...).idTabs(foo) 
    If the function returns true, idTabs will show/hide content (as usual). 
    If the function returns false, idTabs will not take any action. 
    The function is passed four variables: 
      The id of the element to be shown 
      an array of all id's that can be shown 
      the element containing the tabs 
      and the current settings 
 
 selected (string) 
    Class to use for selected. ex: $(...).idTabs(".current") 
    default: ".selected" 
 
 event (string) 
    Event to trigger idTabs on. ex: $(...).idTabs("!mouseover") 
    default: "!click" 
    To bind multiple event, call idTabs multiple times 
      ex: $(...).idTabs("!click").idTabs("!focus") 
 
*/ 
(function($){ 
 
  $.fn.idTabs = function(){ 
    //Loop Arguments matching options 
    var s = {}; 
    for(var i=0; i<arguments.length; ++i) { 
      var a=arguments[i]; 
      switch(a.constructor){ 
        case Object: $.extend(s,a); break; 
        case Boolean: s.change = a; break; 
        case Number: s.start = a; break; 
        case Function: s.click = a; break; 
        case String: 
          if(a.charAt(0)=='.') s.selected = a; 
          else if(a.charAt(0)=='!') s.event = a; 
          else s.start = a; 
        break; 
      } 
    } 
 
    if(typeof s['return'] == "function") //backwards compatible 
      s.change = s['return']; 
     
    return this.each(function(){ $.idTabs(this,s); }); //Chainable 
  } 
 
  $.idTabs = function(tabs,options) { 
    //Settings 
    var meta = ($.metadata)?$(tabs).metadata():{}; 
    var s = $.extend({},$.idTabs.settings,meta,options); 
 
    //Play nice 
    if(s.selected.charAt(0)=='.') s.selected=s.selected.substr(1); 
    if(s.event.charAt(0)=='!') s.event=s.event.substr(1); 
    if(s.start==null) s.start=-1; //no tab selected 
     
    //Setup Tabs 
    var showId = function(){ 
      if($(this).is('.'+s.selected)) 
        return s.change; //return if already selected 
      var id = "#"+this.href.split('#')[1]; 
      var aList = []; //save tabs 
      var idList = []; //save possible elements 
      $("a", tabs).each(function(){ 
        if(this.href.match(/#/)) { 
          aList.push(this); 
          idList.push("#"+this.href.split('#')[1]); 
        } 
      }); 
      if(s.click && !s.click.apply(this,[id,idList,tabs,s])) return s.change; 
      //Clear tabs, and hide all 
	  
	  for(i in aList) $(aList[i]).parent().andSelf().removeClass(s.selected);
	  
      for(i in idList) $(idList[i]).hide(); 
      //Select clicked tab and show content. Add class to anchor and its parent.
	  $(this).parent().andSelf().addClass(s.selected); 

	  
      $(id).show(); 
      return s.change; //Option for changing url 
    } 
 
    //Bind idTabs 
    var list = $("a[href*='#']",tabs).unbind(s.event,showId).bind(s.event,showId); 
    list.each(function(){ $("#"+this.href.split('#')[1]).hide(); }); 
 
    //Select default tab 
    var test=false; 
    if((test=list.filter('.'+s.selected)).length); //Select tab with selected class 
    else if(typeof s.start == "number" &&(test=list.eq(s.start)).length); //Select num tab 
    else if(typeof s.start == "string" //Select tab linking to id 
         &&(test=list.filter("[href*='#"+s.start+"']")).length); 
    if(test) { test.removeClass(s.selected); test.trigger(s.event); } //Select tab 
 
    return s; //return current settings (be creative) 
  } 
 
  //Defaults 
  $.idTabs.settings = { 
    start:0, 
    change:false, 
    click:null, 
    selected:".selected", 
    event:"!click" 
  }; 
 
  //Version 
  $.idTabs.version = "2.2"; 
 
  //Auto-run 
  $(function(){ $(".idTabs").idTabs(); }); 
 
})(jQuery); 
 
} //init 
 
init();
 
})();

/*
 * dropdownNav 
 * On hover dropdown menus for navigation
 * 
 */

$.fn.dropdownNav = function(settings) {
	var settings = jQuery.extend({}, $.fn.dropdownNav.defaultSettings, settings); // import default settings, and override with any supplied settings

	return this.each(function() {
	
		var obj = $(this);
		var listItem = $(obj).children();
		
		$(listItem).hoverIntent(function() {
			$(this).addClass('hover');
			$(settings.dropdownContainer, this).fadeIn(settings.fadeInSpeed);
			}, function() {
				$(this).removeClass('hover');
				$(settings.dropdownContainer, this).fadeOut(settings.fadeOutSpeed);
		});

	});

};

//default settings 
$.fn.dropdownNav.defaultSettings = {
	fadeInSpeed: 'fast',
	fadeOutSpeed: 'fast',
	dropdownContainer: '.inner'
};


/*
 * clearTextfield 
 * Removes value text from the inputfield on focus and puts it back on blur
 * 
 */

$.fn.clearTextfield = function(settings) {
	var settings = jQuery.extend({}, $.fn.clearTextfield.defaultSettings, settings); // import default settings, and override with any supplied settings

	return this.each(function() {

		var textfield = this;
		var currentValue = $(textfield).val();

		$(textfield).focus(function() {
			if ($(this).val() == currentValue) {
				$(this).val('');//remove default value on focus
			}
		});

		$(textfield).blur(function() {
			if ($(this).val() == '') {		//put the default value back if nothing has been entered
				$(this).val(currentValue);
			}
		});

	});

};


/*
 * manageLoginFocus 
 * Set focus on login fields appropriately for recognised users
 * 
 */

(function($) {
  
  $.fn.manageLoginFocus = function(settings) {  
    var settings = $.extend({}, $.fn.manageLoginFocus.defaultSettings, settings );
    
    return this.each(function() {
      
      var emailValue = $.trim( $(settings.emailTextfield).val() );
      
      if ( emailValue.length > 0 ) { // if user is recognised
        $.fn.manageLoginFocus.setFocus.apply( $(settings.passwordTextfield).get(0) ); // call set focus with Password field as context
        $.fn.manageLoginFocus.setChecked.apply( $(settings.existingCustomerOption).get(0) ); // call the setcChecked method with the option input as the context
      } else {
        $.fn.manageLoginFocus.setFocus.apply( $(settings.emailTextfield).get(0) );
      };
      
    });
    
  };
  
  $.fn.manageLoginFocus.setFocus = function() {
    $(this).focus();
  };
  
  $.fn.manageLoginFocus.setChecked = function() {
    $(this).attr('checked', 'checked');
  };
  
  $.fn.manageLoginFocus.defaultSettings = {
    emailTextfield          : '.email input.textfield',
    passwordTextfield       : 'input[name=password]',
    existingCustomerOption  : 'input[value=ExistingUser]'
  };

})(jQuery);



/**
 * jCarouselLite - jQuery plugin to navigate images/any content in a carousel style widget.
 * @requires jQuery v1.2 or above
 *
 * http://gmarwaha.com/jquery/jcarousellite/
 *
 * Copyright (c) 2007 Ganeshji Marwaha (gmarwaha.com)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 * Version: 1.0.1
 * Note: Requires jquery 1.2 or above from version 1.0.1
 */
(function(D){D.fn.jCarouselLite=function(E){E=D.extend({btnPrev:null,btnNext:null,btnGo:null,mouseWheel:false,auto:null,speed:200,easing:null,vertical:false,circular:true,visible:3,start:0,scroll:1,beforeStart:null,afterEnd:null},E||{});return this.each(function(){var N=false,L=E.vertical?"top":"left",G=E.vertical?"height":"width";var F=D(this),P=D("ul",F),I=D("li",P),T=I.size(),S=E.visible;if(E.circular){P.prepend(I.slice(T-S-1+1).clone(true)).append(I.slice(0,S).clone(true));E.start+=S}var R=D("li",P),O=R.size(),U=E.start;F.css("visibility","visible");R.css({overflow:"hidden","float":E.vertical?"none":"left"});P.css({margin:"0",padding:"0",position:"relative","list-style-type":"none","z-index":"1"});F.css({overflow:"hidden",position:"relative","z-index":"2",left:"0px"});var K=E.vertical?A(R):C(R);var Q=K*O;var M=K*S;R.css({width:R.width(),height:R.height()});P.css(G,Q+"px").css(L,-(U*K));F.css(G,M+"px");if(E.btnPrev){D(E.btnPrev).click(function(){return J(U-E.scroll)})}if(E.btnNext){D(E.btnNext).click(function(){return J(U+E.scroll)})}if(E.btnGo){D.each(E.btnGo,function(V,W){D(W).click(function(){return J(E.circular?E.visible+V:V)})})}if(E.mouseWheel&&F.mousewheel){F.mousewheel(function(V,W){return W>0?J(U-E.scroll):J(U+E.scroll)})}if(E.auto){setInterval(function(){J(U+E.scroll)},E.auto+E.speed)}function H(){return R.slice(U).slice(0,S)}function J(V){if(!N){if(E.beforeStart){E.beforeStart.call(this,H())}if(E.circular){if(V<=E.start-S-1){P.css(L,-((O-(S*2))*K)+"px");U=V==E.start-S-1?O-(S*2)-1:O-(S*2)-E.scroll}else{if(V>=O-S+1){P.css(L,-((S)*K)+"px");U=V==O-S+1?S+1:S+E.scroll}else{U=V}}}else{if(V<0||V>O-S){return }else{U=V}}N=true;P.animate(L=="left"?{left:-(U*K)}:{top:-(U*K)},E.speed,E.easing,function(){if(E.afterEnd){E.afterEnd.call(this,H())}N=false});if(!E.circular){D(E.btnPrev+","+E.btnNext).removeClass("disabled");D((U-E.scroll<0&&E.btnPrev)||(U+E.scroll>O-S&&E.btnNext)||[]).addClass("disabled")}}return false}})};function B(E,F){return parseInt(D.css(E[0],F))||0}function C(E){return E[0].offsetWidth+B(E,"marginLeft")+B(E,"marginRight")}function A(E){return E[0].offsetHeight+B(E,"marginTop")+B(E,"marginBottom")}})(jQuery);

/*
 * closeOverlays 
 * Close overlays on escape key press
 * 
 */

$.fn.closeOverlays = function() {
  return $(this).each(function() {

    $(this).keyup(function(e) {
      if (e.which === 27) {
        var topMostOverlay = $('.overlay:visible')[0];
        $(topMostOverlay).trigger('close.sv');
        $('a.close', topMostOverlay).eq(0).click();
      };      
    }); 
  });
};

/* supersleight plugin for jQuery
 * Created by Drew McLellan
 * http://allinthehead.com/retro/338/supersleight-jquery-plugin
 */

jQuery.fn.supersleight = function(settings) {
	settings = jQuery.extend({
		imgs: true,
		backgrounds: true,
		shim: '/Assets/Global/Images-css/transparent.gif',
		apply_positioning: true
	}, settings);
	
	return this.each(function(){
		if (jQuery.browser.msie && parseInt(jQuery.browser.version, 10) < 7 && parseInt(jQuery.browser.version, 10) > 4) {
			jQuery(this).find('*').andSelf().each(function(i,obj) {
				var self = jQuery(obj);
				// background pngs
				if (settings.backgrounds && self.css('background-image').match(/\.png/i) !== null) {
					var bg = self.css('background-image');
					var src = bg.substring(5,bg.length-2);
					var mode = (self.css('background-repeat') == 'no-repeat' ? 'crop' : 'scale');
					var styles = {
						'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='" + mode + "')",
						'background-image': 'url('+settings.shim+')'
					};
					self.css(styles);
				};
				// image elements
				if (settings.imgs && self.is('img[src$=png]')){
					var styles = {
						'width': self.width() + 'px',
						'height': self.height() + 'px',
						'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + self.attr('src') + "', sizingMethod='scale')"
					};
					self.css(styles).attr('src', settings.shim);
				};
				// apply position to 'active' elements
				if (settings.apply_positioning && self.is('a, input') && (self.css('position') === '' || self.css('position') == 'static')){
					self.css('position', 'relative');
				};
			});
		};
	});
};

/**
    sv-slideShow 
    Cross fade a series of content blocks
    
    Requires:
    jQuery 1.3.2+
 */     
/*
#Settings:
 #slideDelay: number (time unit) - default is 3500 ms,
 #    fadeSpeed: number (time unit) - default is 1500 ms
 #    showPagingation:  boolean default is true
 #    paginationAttributes: use object notation to add attribures and their values if you need to comma separated string pairs (which are split by a colon)
*/
(function($) {
    jQuery.fn.slideshow = function(settings) {
        var slideshow = jQuery.fn.slideshow,
            settings = $.extend({}, slideshow.defaultSettings, settings);
                    
        return this.each(function() {
            if ($(this).data('slideshow')) {
                return; // avoid slideshow being setup more than once on same block
            };
            
            var slideshowContainer = this,
                slides = $(this).children(),
                pagination = $('<ol>').attr(settings.paginationAttributes),
                interval;
            
            $(this).data('slideshow', {currentSlide: 0}); // create a value store for the current slide
            
            if (settings.showPagination === true) {
                $(slides).each(function(index) { // create buttons for switching between slides
                    var title = $(this).attr('title') || index;
                   $('<li>').text(title).appendTo(pagination);
                });

                $(pagination).click(function(e) { // handler to switch to a slide and stop playback when the user clicks
                    if (e.target == this) {
                        return; // ignore clicks which are on the button container
                    };
                    
                    var slideIndex = $(this).children().index(e.target);
                    jQuery.fn.slideshow.showSlideAndStop.apply(slideshowContainer, [settings, slideIndex, interval]);
                });
                
                $(slideshowContainer).bind('slideHidden.sv', function(e, data) { // capture event when slide changes
                    $(pagination).children().removeClass('selected')
                                            .eq(data.nextSlide).addClass('selected');               
                });
                

                $(slideshowContainer).after(pagination); // add the pagination controls to the page
                $(pagination).find('li:first').addClass('selected');
            };
            
            $(slides).not(':first').hide(); // show only the first slide for startup
            $(slideshowContainer).trigger('slideShown.sv', [0]); // trigger event for first slide
            
            interval = setInterval(function() {  // setup the timer to change slides
                        jQuery.fn.slideshow.nextSlide.apply(slideshowContainer, [settings]);
                    }, settings.slideDelay);
        });
    };
    
    jQuery.fn.slideshow.nextSlide = function(settings, slideIndex) { // switch to a slide, the next in sequence if no slideIndex is specified
        var slides = $(this).children(), // stop all animation on slides
            slideshowContainer = this,
            currentSlide = $(this).data('slideshow').currentSlide,
            nextSlide = slideIndex === undefined ? currentSlide + 1 : slideIndex,
            eventData = { 'currentSlide': currentSlide, 'nextSlide': nextSlide }; 
            
            if (nextSlide > (slides.length - 1)) { // wrap around to the beginning if the last slide is shown
                nextSlide = 0;
            };
            
            $(slides).eq(currentSlide).fadeOut(settings.fadeSpeed, function() {
                $(this).trigger('slideHidden.sv', [eventData]);
                $(slides).eq(nextSlide).fadeIn(settings.fadeSpeed, function() { // only show the next slide when the fade out is complete
                    $(slideshowContainer).data('slideshow', { currentSlide: nextSlide});
                    $(this).trigger('slideShown.sv', [eventData]); // trigger an event, passing slideIndex argument
                });
            });
    };
    
    jQuery.fn.slideshow.showSlideAndStop = function(settings, slideIndex, interval) {
        clearInterval(interval);
        $(this).children().stop();
        jQuery.fn.slideshow.nextSlide.apply(this, [settings, slideIndex]); // switch to the specified slide
    };
    
    jQuery.fn.slideshow.defaultSettings = {
        slideDelay: 3500,
        fadeSpeed: 1500,
        showPagination: true,
        paginationAttributes: {
            'id': 'sv-slideshow-pagination'
        }
    };
     

})(jQuery);