var $ = jQuery.noConflict();

//Clock -- http://css-tricks.com/css3-clock/

$(document).ready(function() {

      setInterval( function() {
      var seconds = new Date().getSeconds();
      var sdegree = seconds * 6;
      var srotate = "rotate(" + sdegree + "deg)";

      $("#sec").css({"-moz-transform" : srotate, "-webkit-transform" : srotate});

      }, 1000 );

      setInterval( function() {
      var hours = new Date().getHours();
      var mins = new Date().getMinutes();
      var hdegree = hours * 30 + (mins / 2);
      var hrotate = "rotate(" + hdegree + "deg)";

      $("#hour").css({"-moz-transform" : hrotate, "-webkit-transform" : hrotate});

      }, 1000 );

      setInterval( function() {
      var mins = new Date().getMinutes();
      var mdegree = mins * 6;
      var mrotate = "rotate(" + mdegree + "deg)";

      $("#min").css({"-moz-transform" : mrotate, "-webkit-transform" : mrotate});

      }, 1000 );

});

//Make ampersands lush
$(document).ready(function() {
    $("*:contains('&')", document.body)
        .contents()
        .each(
            function() {
                if( this.nodeType == 3 ) {
                    $(this)
                        .replaceWith( this
                            .nodeValue
                            .replace( /&/g, "<cite class='amp'>&</cite>" )
                        );
                }
            }
        );
});

// Author:              Matt Rossi
// Website:             ifohdesigns.com
// Article Source:      http://ifohdesigns.com/blog/tutorials/
// Last Modified:       August 26, 2008

$(document).ready(function() {
   
 $("#panel").hide();

 var a = $("<a>toggle header</a>").attr('href','#').addClass("trigger");
 $('#nice .in').before(a);


   $(".trigger").click(function(){

  if ($("#panel").is(":hidden")) {
        $("#panel").slideDown("slow");
	$(this).addClass("active");
         $.cookie('showTop', 'collapsed');
	return false;
	
      } else {
        $("#panel").slideUp("slow");
	$(this).removeClass("active");
        $.cookie('showTop', 'expanded');
	return false;

      }
	
   });
 
});

//Tabs
//jQuery(document).ready(function($) {$('#good > menu ').tabs({ fx: { opacity: 'toggle' } });});
jQuery(document).ready(function($) {$('#good > menu ').tabs();});

//Pre and ap ends
jQuery(document).ready(function($){$(".soon").prepend('<cite class="la"></cite>');});

//Scroll
jQuery(document).ready(function($) {
	$('nav a[href*="#"]').click(function() {
	   var elementClicked = $(this).attr("href");
	   var destination = $(elementClicked).offset().top;
	   $("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination-20}, 800 );
	   return false;
	});
});

//Fancybox
$(document).ready(function() { 
	 $("#fragment-2 a").fancybox(); 
	 $("a#inline").fancybox({ 'hideOnContentClick': true }); 
	 $("a.fbg").fancybox({ 'zoomSpeedIn': 300, 'zoomSpeedOut': 300, 'overlayShow': false }); 
}); 




/*

//Captions - https://buildinternet.s3.amazonaws.com/live-tutorials/sliding-boxes/index.htm
$(document).ready(function(){
	$('#fragment-1 .boxgrid.caption').hover(function(){
		$(".cover", this).stop().animate({top:'-1px'},{queue:false,duration:160});
	}, function() {
		$(".cover", this).stop().animate({top:'109px'},{queue:false,duration:160});
	});
});

//Cufon
jQuery(document).ready(function($){Cufon.replace('',{ hover: true});});

//Captions - https://buildinternet.s3.amazonaws.com/live-tutorials/sliding-boxes/index.htm
$(document).ready(function(){
	$('.boxgrid.caption').hover(function(){
		$(".cover", this).stop().animate({top:'-1px'},{queue:false,duration:160});
	}, function() {
		$(".cover", this).stop().animate({top:'109px'},{queue:false,duration:160});
	});
});


//Make ampersands lush
$(document).ready(function() {
    $("*:contains('&')", document.body)
        .contents()
        .each(
            function() {
                if( this.nodeType == 3 ) {
                    $(this)
                        .replaceWith( this
                            .nodeValue
                            .replace( /&/g, "<cite class='amp'>&</cite>" )
                        );
                }
            }
        );
});

//Pre and ap ends
jQuery(document).ready(function($){$(".addclass").prepend('add stuff');});


//Add class
jQuery(document).ready(function($){$('').addClass("none");});

//Fade in
jQuery(document).ready(function($){$('').fadeIn(2000);});


//Open in external windows
function externalLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "external")
     anchor.target = "_blank";
 }
}
window.onload = externalLinks;

//JQuery Plugin: "EqualHeights" by:	Scott Jehl, Todd Parker, Maggie Costello Wachs (http://www.filamentgroup.com) Copyright (c) 2008 Filament Group. Licensed under GPL (http://www.opensource.org/licenses/gpl-license.php)
jQuery(document).ready(function($){ 	
	function equalHeight(group) {
		tallest = 0;
		group.each(function() {
			thisHeight = $(this).height();
			if(thisHeight > tallest) {
				tallest = thisHeight;
			}
		});
		group.height(tallest);
	}

	equalHeight($ ( "add stuff" ) );
	
});

*/