/* Declare a namespace for the site */
var Site = window.Site || {};

/* Create a closure to maintain scope of the '$'
   and remain compatible with other frameworks.  */
(function($) {

	//same as $(document).ready();
	$(function() {

		// Color rollover section
		$(".colorTrigger").mouseover(function(){
			$(".colors").hide();
		});

		$("#rollRedTrigger").mouseover(function(){
			$("#rollRed").show();
		});
		$("#rollOrangeTrigger").mouseover(function(){
			$("#rollOrange").show();
		});
		$("#rollGreenTrigger").mouseover(function(){
			$("#rollGreen").show();
		});
		$("#rollBlueTrigger").mouseover(function(){
			$("#rollBlue").show();
		});
		$("#rollBlackTrigger").mouseover(function(){
			$("#rollBlack").show();
		});

		/*$("#message").delay(1500).show("blind","slow");*/

		/*
		 $("#message").click(function(){
			$("#message").hide("blind","slow");
		});
		*/

		$('#message ul').list_ticker({
			speed:5000,
			effect:'slide'
		})

		$("#phone").mouseover(function(){
			$("#phone").text("1-661-776-5378");
		});
		$("#phone").mouseout(function(){
			$("#phone").text("1-661-SPOKESTER");
		});

		// Replace logo and bike image if IE6
		if ($.browser.msie && $.browser.version.substring(0,1) === '6') {
			$("#spokesterLogo").attr("src", "_/img/layout/ieSpokester_logo.gif");
			$("#bikePhoto").attr("src", "_/img/layout/ieBike.gif");
		}

		// Trigger lightbox on gallery page
		$(".gallery .thumbnails").lightBox();


	});


	$(window).bind("load", function() {



	});

})(jQuery);



/* List Ticker by Alex Fish
// www.alexefish.com
//
// options:
//
// effect: fade/slide
// speed: milliseconds
*/

(function($){
  $.fn.list_ticker = function(options){

    var defaults = {
      speed:4000,
	  effect:'slide'
    };

    var options = $.extend(defaults, options);

    return this.each(function(){

      var obj = $(this);
      var list = obj.children();
      list.not(':first').hide();

      setInterval(function(){

        list = obj.children();
        list.not(':first').hide();

        var first_li = list.eq(0)
        var second_li = list.eq(1)

		if(options.effect == 'slide'){
			first_li.slideUp();
			second_li.slideDown(function(){
				first_li.remove().appendTo(obj);
			});
		} else if(options.effect == 'fade'){
			first_li.fadeOut(function(){
				second_li.fadeIn();
				first_li.remove().appendTo(obj);
			});
		}
      }, options.speed)
    });
  };
})(jQuery);

