function MM_preloadImages() { //v3.0
	var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
	}

function quicknavigation(obj) 
{
var selectbox = eval(obj);
var myindex=selectbox.selectedIndex;
if (myindex == "") return;
if (selectbox.options[myindex].value == "") return;
window.location = selectbox.options[myindex].value;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

 
$(document).ready(function() {		
	
	//Execute the slideShow
	slideShow();
 
});
 
function slideShow() {
 
	//Set the opacity of all images to 0
	$('#gallery a').css({opacity: 0.0});
	
	//Get the first image and display it (set it to full opacity)
	$('#gallery a:first').css({opacity: 1.0});
	
	//Set the caption background to semi-transparent
	$('#gallery .caption').css({opacity: 0.7});
 
	//Resize the width of the caption according to the image width
	$('#gallery .caption').css({width: $('#gallery a').find('img').css('width')});
	
	//Get the caption of the first image from REL attribute and display it
	$('#gallery .content').html($('#gallery a:first').find('img').attr('rel'))
	.animate({opacity: 0.7}, 400);
	
	//Call the gallery function to run the slideshow, 6000 = change to next image after 6 seconds
	setInterval('gallery()',6000);
	
}
 
function gallery() {
	
	//if no IMGs have the show class, grab the first image
	var current = ($('#gallery a.show')?  $('#gallery a.show') : $('#gallery a:first'));
 
	//Get next image, if it reached the end of the slideshow, rotate it back to the first image
	var next = ((current.next().length) ? ((current.next().hasClass('caption'))? $('#gallery a:first') :current.next()) : $('#gallery a:first'));	
	
	//Get next image caption
	var caption = next.find('img').attr('rel');	
	
	//Set the fade in effect for the next image, show class has higher z-index
	next.css({opacity: 0.0})
	.addClass('show')
	.animate({opacity: 1.0}, 1000);
 
	//Hide the current image
	current.animate({opacity: 0.0}, 1000)
	.removeClass('show');
	
	//Set the opacity to 0 and height to 1px
	$('#gallery .caption').animate({opacity: 0.0}, { queue:false, duration:0 }).animate({height: '1px'}, { queue:true, duration:300 });	
	
	//Animate the caption, opacity to 0.7 and heigth to 100px, a slide up effect
	$('#gallery .caption').animate({opacity: 0.7},70 ).animate({height: '70px'},500 );
	
	//Display the content
	$('#gallery .content').html(caption);
	
	
}

	$(document).ready(function(){
	
		// generateSprites arguments: 
		// 1st - parent class (the main class on the parent ul), with preceding period
		// 2nd - selected prefix (eg. for a selected class of "selected-about", use "selected-" as the value)
		// 3rd - :active state toggle, set to true if you've defined :active states (and the jQuery equivalent) in your CSS
		// 4th - animation speed, in milliseconds (eg. 300 = 0.3 seconds)
		// 5th - animation style, as a string. Set to "slide" or "fade" (defaults to "fade")
		
		// example usage:
		// generateSprites(".navigation", "selected-", true, 300, "fade");
		// generateSprites(".top-nav", "position-", true, 200, "slide");
		// generateSprites(".sidebar-nav", "current-", false, 150, "fade");
 
		
		generateSprites(".nav", "current-", true, 400, "fade");
 
	});
		 
 
     getTwitters('TwistTweets', {
        id: 'twist_studio', 
        count: 4, 
        withFriends: true, // currently disabled due to change in Twitter API
        enableLinks: true, 
        ignoreReplies: true,
        template: '%text%'
    });
	
	
$(document).ready(function(){
				//To switch directions up/down and left/right just place a "-" in front of the top/left attribute
				//Vertical Sliding
				$('.boxgrid.slidedown').hover(function(){
					$(".cover", this).stop().animate({top:'-128px'},{queue:false,duration:300});
				}, function() {
					$(".cover", this).stop().animate({top:'0px'},{queue:false,duration:300});
				});
				//Horizontal Sliding
				$('.boxgrid.slideright').hover(function(){
					$(".cover", this).stop().animate({left:'128px'},{queue:false,duration:300});
				}, function() {
					$(".cover", this).stop().animate({left:'0px'},{queue:false,duration:300});
				});
				//Diagnal Sliding
				$('.boxgrid.thecombo').hover(function(){
					$(".cover", this).stop().animate({top:'127px', left:'200px'},{queue:false,duration:300});
				}, function() {
					$(".cover", this).stop().animate({top:'0px', left:'0px'},{queue:false,duration:300});
				});
				//Partial Sliding (Only show some of background)
				$('.boxgrid.peek').hover(function(){
					$(".cover", this).stop().animate({left:'-200px'},{queue:false,duration:300});
				}, function() {
					$(".cover", this).stop().animate({left:'0px'},{queue:false,duration:300});
				});
				//Full Caption Sliding (Hidden to Visible)
				$('.boxgrid.captionfull').hover(function(){
					$(".cover", this).stop().animate({top:'60px'},{queue:false,duration:160});
				}, function() {
					$(".cover", this).stop().animate({top:'127px'},{queue:false,duration:160});
				});
				//Caption Sliding (Partially Hidden to Visible)
				$('.boxgrid.caption').hover(function(){
					$(".cover", this).stop().animate({top:'65px'},{queue:false,duration:160});
				}, function() {
					$(".cover", this).stop().animate({top:'99px'},{queue:false,duration:160});
				});
			});
