function mycarousel_initCallback(carousel)
{
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });
 
    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });
 
    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};

$(document).ready(function() {
    
    $('.slideshow').cycle({
    fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
    timeout: 5000 //modifying the speed of the transition
  });

   $("#mycarousel3").jcarousel({        
        auto: 4,
        scroll: 1,
        wrap: 'circular',
        initCallback: mycarousel_initCallback});
   

 

$('#weathercarousel').jcarousel({
        auto: 5,
        scroll: 1,
        wrap: 'circular',
        initCallback: mycarousel_initCallback
    });
       $("#content1").hide();
 
    //toggle the componenet with id more
    $("#more").click(function()
      {

                $('#content1').slideToggle('slow');
                $(this).text($(this).text() == 'Collapse page to hide information >>' ? 'Expand page for more information >>' : 'Collapse page to hide information >>');
            

      });
});

var minFontSize = "14";
var maxFontSize = "20";
var classes 	= new Array('sub_con_text','welcome_text');
function increase_font_size()
{

	for(page_class in classes)
	{
  
		if ($('#body_text').hasClass('.'+classes[page_class])) 
		{
			var currentFontSize = $('.'+classes[page_class]).css('font-size');
      
			var fontSizeCheck   = currentFontSize.substring(0, currentFontSize.length-2);
     
			
			if(fontSizeCheck > maxFontSize)
			{
				confirm_message("<h2>AA MOTORHOMES<\/h2><p>You have Increased the text Size to Maximum<\/p>");
				return false;
			}
			else
			{
				var currentFontSizeNum = parseFloat(currentFontSize, 10);
				var newFontSize = currentFontSizeNum*1.2;
				$('.'+classes[page_class]).css('font-size', newFontSize);
				return false;
			}
		}
		
		
	}
	
}

function decrease_font_size()
{
	
	for(page_class in classes)
	{
		if ($('#body_text').hasClass('.'+classes[page_class])) 
		{
			var currentFontSize = $('.'+classes[page_class]).css('font-size');
			currentFontSizes    =  parseFloat(currentFontSize, 10);
			if(currentFontSizes > minFontSize)
			{
				//currentFontSize = minFontSize;
       var currentFontSize   = currentFontSize.substring(0, currentFontSize.length-2);
			}
			var fontSizeCheck   = currentFontSizes;
		
			if(fontSizeCheck < minFontSize)
			{
				confirm_message("<h2>AA MOTORHOMES<\/h2><br\/><p>You have descreased the text Size to Minimum Level<\/p>");
				return false;
			}
			else
			{
				
				var currentFontSizeNum = parseFloat(currentFontSize, 10);
				var newFontSize 	   = currentFontSizeNum*0.8;
				
				$('.'+classes[page_class]).css('font-size', newFontSize);
				return false;
			}
		}
	}
}
