// JavaScript Document

(function($) {
	/*
		jquery.twitter.js v1.0
		Last updated: 26 October 2008

		Created by Damien du Toit
		http://coda.co.za/blog/2008/10/26/jquery-plugin-for-twitter

		Licensed under a Creative Commons Attribution-Non-Commercial 3.0 Unported License
		http://creativecommons.org/licenses/by-nc/3.0/
	*/

	$.fn.getTwitter = function(options) {
		var o = $.extend({}, $.fn.getTwitter.defaults, options);
	
		// hide container element
		$(this).hide();
	
		// add heading to container element
		if (o.showHeading) {
			$(this).append('<h3>'+o.headingText+'</h3>');
		}

		// add twitter list to container element
		$(this).append('<ul id="twitter_update_list"><li></li></ul>');

		// hide twitter list
		$("ul#twitter_update_list").hide();

		// add preLoader to container element
		var pl = $('<p id="'+o.preloaderId+'">'+o.loaderText+'</p>');
		$(this).append(pl);

		// add Twitter profile link to container element
		if (o.showProfileLink) {
			$(this).append('<a id="profileLink" href="http://twitter.com/'+o.userName+'">http://twitter.com/'+o.userName+'</a>');
		}

		// show container element
		$(this).show();
	
		$.getScript("http://twitter.com/javascripts/blogger.js");
		$.getScript("http://twitter.com/statuses/user_timeline/"+o.userName+".json?callback=twitterCallback2&count="+o.numTweets, function() {
			// remove preLoader from container element
			$(pl).remove();

			// show twitter list
			if (o.slideIn) {
				$("ul#twitter_update_list").slideDown(1000);
			}
			else {
				$("ul#twitter_update_list").show();
			}

			// give first list item a special class
			$("ul#twitter_update_list li:first").addClass("firstTweet");

			// give last list item a special class
			$("ul#twitter_update_list li:last").addClass("lastTweet");
		});
	};

	// plugin defaults
	$.fn.getTwitter.defaults = {
		userName: null,
		numTweets: 2,
		preloaderId: "preloader",
		loaderText: "Loading tweets...",
		slideIn: false,
		showHeading: true,
		headingText: "Latest Tweets",
		showProfileLink: true
	};
})(jQuery);

$(document).ready(function() {
	$("#twitter").getTwitter({
		userName: "Sarjeants",
		numTweets: 2,
		loaderText: "Loading tweets...",
		slideIn: true,
		showHeading: true,
		headingText: "Twitter Feed",
		showProfileLink: false
	});
	
	
$("#side").nestAccordion({initShow : "#current"});
$("#accord").nestAccordion({initShow : "#current"});


	
	$('#regForm').validate();
	

	$('#serviceAccord').accordion({ 
      header: '.main',
		collapsible: true,
		autoHeight: false,
		active: false
		});
	
			$('#portAccord').accordion({ 
      header: '.main',
		 collapsible: true,
		autoHeight: false,
		active: false
	
	});
	
	$("#philanthropyAccord").accordion({
	 header: '.main',
     collapsible: true,
	 autoHeight: false
	});
		
	
	$('#teamAccord').accordion({
		header: '.main',
	    collapsible: true,
		autoHeight: false,
		clearStyle: true
	});

	
	
		$('#list1b').accordion({ 
			header: '.main-accord',
			collapsible: true,
			autoHeight: false 
		});	


	    $('.fleetSlider').cycle({ 
        fx:     'scrollHorz', 
        speed:   500, 
        timeout: 9000, 
		prev:    '#fleet_next',
        next:    '#fleet_prev',
        pager:  '#fleet-nav',
		pause: 1,
	    pagerAnchorBuilder: function(index, el) {
          return '<a href="#"> </a>'; // whatever markup you want
	    }
    }); 
		
		$("#charMessage").charCount({
    allowed: 155,		
    warning: 20
});

		$("#keywords").charCount({
    allowed: 300,		
    warning: 20
});

		$("#title").charCount({
    allowed: 115,		
    warning: 20
});




/*	$('.mainSliderScroll').cycle({ 
        fx:     'fade', 
        speed:   500, 
        timeout: 6000, 
		pause: 1,
		prev:    '#prev',
        next:    '#next',
        pager:  '#slider-nav',
	    pagerAnchorBuilder: function(index, el) {
          return '<a href="#"> </a>'; // whatever markup you want
	    } 
		}); 
	
*/

 

	    $('.newsNewPrevWrap').cycle({ 
        fx:     'scrollHorz', 
        timeout: 0, 
		prev:    '#newsPrev',
        next:    '#newsNext',
        pager:  '#newsPageer'
    }); 
	



 


    $('#subSlider').cycle({ 
        fx:     'fade', 
        speed:   500, 
        timeout: 6000, 
		pause: 1,
		prev:    '.subPrev',
        next:    '.subNext',
        pager:  '#subSlider-nav',
	    pagerAnchorBuilder: function(index, el) {
          return '<a href="#"> </a>'; // whatever markup you want
	    }
    }); 
 


    $('#subSlider3').cycle({ 
        fx:     'fade', 
        speed:   500, 
        timeout: 6000, 
		pause: 1,
		prev:    '.subPrev2',
        next:    '.subNext2',
        pager:  '#subSlider-nav',
	    pagerAnchorBuilder: function(index, el) {
          return '<a href="#"> </a>'; // whatever markup you want
	    }
    }); 




    $('#subSlider2').cycle({ 
        fx:     'fade', 
        speed:   500, 
        timeout: 6000, 
		pause: 1,
		prev:    '.prev1',
        next:    '.next1',
        pager:  '#subSlider-nav',
	    pagerAnchorBuilder: function(index, el) {
          return '<a href="#"> </a>'; // whatever markup you want
	    }
    }); 


    $('#subSlider3').cycle({ 
        fx:     'fade', 
        speed:   500, 
        timeout: 6000, 
		pause: 1,
		prev:    '.prev3',
        next:    '.next3',
        pager:  '#subSlider-nav',
	    pagerAnchorBuilder: function(index, el) {
          return '<a href="#"> </a>'; // whatever markup you want
	    }
    }); 
 


    $('#subSlider4').cycle({ 
        fx:     'fade', 
        speed:   500, 
        timeout: 6000, 
		pause: 1,
		prev:    '#subPrev',
        next:    '#subNext',
        pager:  '#subSlider-nav',
	    pagerAnchorBuilder: function(index, el) {
          return '<a href="#"> </a>'; // whatever markup you want
	    }
    }); 



    $('#subSlider5').cycle({ 
        fx:     'fade', 
        speed:   500, 
        timeout: 6000, 
		pause: 1,
		prev:    '.prev4',
        next:    '.next4',
        pager:  '#subSlider-nav',
	    pagerAnchorBuilder: function(index, el) {
          return '<a href="#"> </a>'; // whatever markup you want
	    }
    }); 
	
	
	    $('.testSlider').cycle({ 
        fx:     'fade', 
        speed:   500, 
        timeout: 6000, 
		pause: 1,
		prev:    '.test-prev',
        next:    '.test-next'
    //    pager:  '#subSlider-nav',
	//    pagerAnchorBuilder: function(index, el) {
      //    return '<a href="#"> </a>'; // whatever markup you want
	   // }
    });
	
}); 
