$(document).ready(function(){
	/*
	$('a[href^=http]').click( function() {
		window.open(this.href);
		return false;
	});
	*/

	$('.wordstyle').wrapInner('<span />');

	//$('#home .peKenBurns').peKenburnsSlider();

	/**
	*** SIS Nav
	***/
	$('.breadcrumb li a:not(#Register)').click(function(e){
		e.preventDefault();
		e.stopPropagation();
		var index = $('.breadcrumb li').index($(this).parent()) + 1;
		$('.breadcrumb').attr('data-active', 'index_'+index);

		$('.sis_page:not(#sis_page_'+index+')').fadeOut();
		$('.sis_page:not(#sis_page_'+index+')').slideUp(200);

		$targ = $('#sis_page_'+index);
		$targ.slideDown(200, 'easeInQuad', function(){
			$(this).fadeTo(200,1);
		});

	});
	$('.breadcrumb li:first a').trigger('click');


	/**
	*** THE "READ MORE" / "READ LESS" BUTTONS
	***
	*** Instructions:
	*** For this to work, the html structure should be
	***
	***	<div>
	***		...any html (but no <p>'s)...
	***		<p>The first paragraph will show</p>
	***		<p>Any subsequent...</p>
	***		<p>Paragraphs will be hidden</p>
	***		<a href="#" class="readmore"></a>
	***	</div>
	***/
	this_all = 'p:not(:first)'

	$('.readmore').parent().find(this_all).slideUp('fast');
	$('.readmore').each( function(){
		if( $(this).parent().find(this_all).length === 0 ) $(this).hide();
		$(this).html('read more');
	});
	$('.readmore').toggle(
		function(){
			$(this).parent().find(this_all).slideDown('fast');
			$(this).addClass('readless').html('read less');
		},
		function(){
			$(this).parent().find(this_all).slideUp('fast');
			$(this).removeClass('readless').html('read more');
		}
	);







$(".tweet").tweet({
            username: "expectreferrals",
            join_text: "auto",
            avatar_size: 32,
            count: 1,
            auto_join_text_default: "we said,",
            auto_join_text_ed: "we",
            auto_join_text_ing: "we were",
            auto_join_text_reply: "we replied to",
            auto_join_text_url: "we were checking out",
            loading_text: "loading tweets…"
        });


        $("#userandquery").tweet({
          count: 3,
          query: "from:expectreferrals http",
          loading_text: "searching twitter…"
        });





	/**
	*** THE FANCY IMAGE
	***
	*** simple library to make the images
	*** have a triple border and a shadow
	***
	*** authored by hugh@gauged
	***/
	$('.shadowbox').fancify();

});

(function( $ ) {
  $.fn.fancify = function( selector ) {

	$(this).each(function(){
		$this = $(this);
		klass = $this.attr('class') +'-container '+ $this.attr('data-size');
		$this.wrap('<div class="'+klass+'" />');
	});
  };
})( jQuery );

(function($){
 $.fn.extend({

  customStyle : function(options) {
    if(!$.browser.msie || ($.browser.msie&&$.browser.version>6)){
    return this.each(function() {

      var currentSelected = $(this).find(':selected');
      $(this).after('<span class="customStyleSelectBox"><span class="customStyleSelectBoxInner">'+currentSelected.text()+'</span></span>').css({position:'absolute', opacity:0,fontSize:$(this).next().css('font-size')});
      var selectBoxSpan = $(this).next();
      var selectBoxWidth = parseInt($(this).width()) - parseInt(selectBoxSpan.css('padding-left')) -parseInt(selectBoxSpan.css('padding-right'));
      var selectBoxSpanInner = selectBoxSpan.find(':first-child');
      selectBoxSpan.css({display:'inline-block'});
      selectBoxSpanInner.css({width:selectBoxWidth, display:'inline-block'});
      var selectBoxHeight = parseInt(selectBoxSpan.height()) + parseInt(selectBoxSpan.css('padding-top')) + parseInt(selectBoxSpan.css('padding-bottom'));
      $(this).height(selectBoxHeight).change(function(){
        // selectBoxSpanInner.text($(this).val()).parent().addClass('changed');   This was not ideal
      selectBoxSpanInner.text($(this).find(':selected').text()).parent().addClass('changed');
        // Thanks to Juarez Filho & PaddyMurphy
      });

    });
    }
  }
 });
})(jQuery);


