$(window).bind('load', function () {
  // run the cross fade plugin against selector
  $('img.fade').crossfade();
//  $('a.fade').crossfadeLinks();
});

$(document).ready(function(){

//  $("#adv2").fadeIn(2000);

//  function animateLinks ()
//  {
//	  $("#products_content a").animate({color: '#950148'}, 1500).animate({color: 'white'}, 1500, animateLinks);
//  }

//  animateLinks();

  $("#accordion-example").accordion();


  $('#gallery a').lightBox({
	imageLoading: 'http://www.earlybirdapplications.com/images/lightbox-ico-loading.gif',
	imageBtnClose: 'http://www.earlybirdapplications.com/images/lightbox-btn-close.gif',
	imageBtnPrev: 'http://www.earlybirdapplications.com/images/lightbox-btn-prev.gif',
	imageBtnNext: 'http://www.earlybirdapplications.com/images/lightbox-btn-next.gif'
  });


	$('a.fade-black').hover(
	function() { $(this).stop().animate({color: '#950148'}, 250); },
	function() { $(this).stop().animate({color: '#212121'}, 1500); });

	$('a.fade-white').hover(
		function() { $(this).stop().animate({color: '#950148'}, 250); },
		function() { $(this).stop().animate({color: 'white'}, 1500); });

//	 $("#adv2").idTabs(function(id,list,set){
//	 	var $img = $("a.selected").find("img.fade");
//	 	if ($img.length > 0) {
//		 	$img.attr("src", $img.attr("src").replace(/_hover.jpg/g, '.jpg'));
//		 	$img.attr("id", "");
//		 	$img.css("opacity", 0);
//		 	$img.stop().animate({opacity: 1}, 1500);
//		 }
//    	$("a",set).removeClass("selected").filter("[@href='"+id+"']",set).addClass("selected");
//    	var path = $("a",set).filter("[@href='"+id+"']",set).find(".fade").attr("src").replace(/.jpg/g, '_hover.jpg');
//    	$(this).find(".fade").attr("src", path);
//    	$(this).find(".fade").attr("id", "selected");
//
//    	for(i in list) {
//      		$(list[i]).hide();
//    	}
//
//    	$(id).fadeIn(1000);
//    	return false;
//  	 });

	$('img.imghover').tooltip({
    delay: 0,
    track: true,
    showURL: false,
    fixPNG: true,
    bodyHandler: function() {
     var targetImage = this.src.replace(/.png/g, '_big.jpg');
        return $("<img/>").attr("src", targetImage);
    }
	});

	$('a.imghover').tooltip({
    delay: 0,
    track: true,
    showURL: false,
    fixPNG: true,
    bodyHandler: function() {
     var targetImage = this.name.replace(/.png/g, '_big.jpg');
        return $("<img/>").attr("src", targetImage);
    }
	});


$(".pseudo-accordion li>a").click(function() {
		$(this).next().toggle("slow");
	}).next().hide();

$(".order_form").validate();

	//hide message_body after the first one
//	$(".message_list .message_body:gt(0)").hide();
//	$(".message_head:first").children(".plusminus:first").text("-");
//
//	//toggle message_body
//	$(".message_head").click(function(){
//		$(this).next(".message_body").slideToggle("fast", function() {
//	      	var text = $(this).siblings(".message_head").children(".plusminus:first").text();
//	        if (text == "-")
//		        $(this).siblings(".message_head").children(".plusminus:first").text("+");
//		    else
//		        $(this).siblings(".message_head").children(".plusminus:first").text("-");
//		});
//		return false;
//	});
});
