/* PROJECT DETAILS: pageid : id : name : year : images : videos */

/*
?page_id=246	001 The Angel (1994) [1]
(http://www.vimeo.com/6758929)

?page_id=248	002 Ceremony of Innocence (1997) [3]
(http://www.vimeo.com/6422665 / http://www.vimeo.com/6743011)

?page_id=250	003 Commedia dell'Arte (2003) [1]
(http://www.vimeo.com/6466651)

?page_id=252	004 Prospero's Island (2004) [4]
(http://www.vimeo.com/6759813)

?page_id=254	005 Athens Under (2004) [3]

?page_id=256	006 theHive/Dreamer (ongoing) [6]
(http://www.vimeo.com/6468167 / http://www.vimeo.com/6706527 / http://www.vimeo.com/6979774)

?page_id=258	007 remworlds (2005) [1]

?page_id=260	008 Beethoven's Hair (2006) [5]
(http://www.vimeo.com/6750044)

?page_id=262	009 everSPACE (ongoing) [5]
(http://www.vimeo.com/6979909)

?page_id=264	010 Mobile Souls (ongoing) [1]
(http://www.vimeo.com/6987102)

?page_id=266	011 Gabble (ongoing) [1]
?page_id=268	012 Life Lines (2009) [1]
?page_id=270	013 thememory.com (ongoing) [1]
?page_id=272	014 Poke Circus (ongoing) [1]
?page_id=274	015 Time Tremors (ongoing) [9]
*/

// AJAX http://daniel.lorch.cc/docs/ajax_simple/
var http = false;
if(navigator.appName == "Microsoft Internet Explorer") {
  http = new ActiveXObject("Microsoft.XMLHTTP");
} else {
  http = new XMLHttpRequest();
} 

// GET THE VIDEOS

//PROJECT OO1 : VIDEO 001
function p001v1() {
  http.open("GET", "/wp-content/themes/x/projects/001v1.php", true);
  http.onreadystatechange=function() { if(http.readyState == 4) { document.getElementById('p001').innerHTML = http.responseText; }}
  http.send(null);
}

//PROJECT OO2 : VIDEO 001
function p002v1() {
  http.open("GET", "/wp-content/themes/x/projects/002v1.php", true);
  http.onreadystatechange=function() { if(http.readyState == 4) { document.getElementById('p002').innerHTML = http.responseText; }}
  http.send(null);
}

	//PROJECT OO2 : VIDEO 002
	function p002v2() {
	  http.open("GET", "/wp-content/themes/x/projects/002v2.php", true);
	  http.onreadystatechange=function() { if(http.readyState == 4) { document.getElementById('p002').innerHTML = http.responseText; }}
	  http.send(null);
	}

//PROJECT OO3 : VIDEO 001
function p003v1() {
  http.open("GET", "/wp-content/themes/x/projects/003v1.php", true);
  http.onreadystatechange=function() { if(http.readyState == 4) { document.getElementById('p003').innerHTML = http.responseText; }}
  http.send(null);
}

//PROJECT OO4 : VIDEO 001
function p004v1() {
  http.open("GET", "/wp-content/themes/x/projects/004v1.php", true);
  http.onreadystatechange=function() { if(http.readyState == 4) { document.getElementById('p004').innerHTML = http.responseText; }}
  http.send(null);
}

//PROJECT OO5 : NO VIDEO

//PROJECT OO6 : VIDEO 001
function p006v1() {
  http.open("GET", "/wp-content/themes/x/projects/006v1.php", true);
  http.onreadystatechange=function() { if(http.readyState == 4) { document.getElementById('p006').innerHTML = http.responseText; }}
  http.send(null);
}

	//PROJECT OO6 : VIDEO 002
	function p006v2() {
	  http.open("GET", "/wp-content/themes/x/projects/006v2.php", true);
	  http.onreadystatechange=function() { if(http.readyState == 4) { document.getElementById('p006').innerHTML = http.responseText; }}
	  http.send(null);
	}

		//PROJECT OO6 : VIDEO 003
		function p006v3() {
		  http.open("GET", "/wp-content/themes/x/projects/006v3.php", true);
		  http.onreadystatechange=function() { if(http.readyState == 4) { document.getElementById('p006').innerHTML = http.responseText; }}
		  http.send(null);
		}

//PROJECT OO7 : NO VIDEO

//PROJECT OO8 : VIDEO 001
function p008v1() {
  http.open("GET", "/wp-content/themes/x/projects/008v1.php", true);
  http.onreadystatechange=function() { if(http.readyState == 4) { document.getElementById('p008').innerHTML = http.responseText; }}
  http.send(null);
}

//PROJECT OO9 : VIDEO 001
function p009v1() {
  http.open("GET", "/wp-content/themes/x/projects/009v1.php", true);
  http.onreadystatechange=function() { if(http.readyState == 4) { document.getElementById('p009').innerHTML = http.responseText; }}
  http.send(null);
}

//PROJECT O10 : VIDEO 001
function p010v1() {
  http.open("GET", "/wp-content/themes/x/projects/010v1.php", true);
  http.onreadystatechange=function() { if(http.readyState == 4) { document.getElementById('p010').innerHTML = http.responseText; }}
  http.send(null);
}

//PROJECT O11 : NO VIDEO
//PROJECT O12 : NO VIDEO
//PROJECT O13 : NO VIDEO
//PROJECT O14 : NO VIDEO
//PROJECT O15 : NO VIDEO

/* +++ MORE SETUP BELOW +++ */

//TOGGLE TWEETS, FOLLOW & CONTACT INFO
function toggle(id) {
	var state = document.getElementById(id).style.display;
	if (state == 'block') {
		document.getElementById(id).style.display = 'none';
	} else {
		document.getElementById(id).style.display = 'block';
	}
}

// TWEETABLE Alex's tweets
// http://theodin.co.uk/blog/javascript/tweetable-jquery-plugin.html

$(function(){
 $('#tweets').tweetable({username: 'alexmayhew', time: true, limit: 15});
});

// DRAGGABLE SLIDESHOW
// http://docs.jquery.com/UI/Draggable

/*$(document).ready(function() {
	$('#slideshowContainer').draggable({ axis: 'y', containment: '#section' });
});*/

// SCROLLABLE PANES
// http://woork.blogspot.com/2009/08/elegant-scrollpanes-with-jquery-and.html

$(function() {
	$('#project-text').jScrollPane();
	$('.scroll-profile').jScrollPane();
	$('.scroll-blog').jScrollPane();
	$('.scroll-news').jScrollPane();
});

// SAFARI FIX?
// http://code.google.com/p/jscrollpane/issues/detail?id=30

$(document).ready(function() {
	$('.scroll-profile').show();
	//$('.scroll-blog').show();
	$('.scroll-news').show();
});

//SLIDING BOXES & CAPTIONS ON PROJECT/PARTNERS PAGES (INCLUDES EASING v1.3)
//http://buildinternet.com/2009/03/sliding-boxes-and-captions-with-jquery/
//http://www.commadot.com/jquery/easing.php

$(document).ready(function(){
	//To switch directions up/down and left/right just place a "-" in front of the top/left attribute
	
	//Full Caption Sliding (Hidden to Visible) [WE'RE USING THIS ONE]
	$('.boxgrid.captionfull').hover(function(){
		$(".cover", this).stop().animate({top:'0px'},{queue:false,duration:350,easing:'easeInCubic'});
	}, function() {
		$(".cover", this).stop().animate({top:'144px'},{queue:false,duration:350,easing:'easeOutCubic'});
	});
	
		$('.boxgrid.captionfull').hover(function(){
			$(".openMe", this).stop().animate({top:'144px'},{queue:false,duration:100});
		}, function() {
			$(".openMe", this).stop().animate({top:'0px'},{queue:false,duration:100});
		});
	
	//Horizontal Sliding: the "-" makes it slide left instead of right
	$('.boxgrid.slideright').hover(function(){
		$(".cover", this).stop().animate({left:'-216px'},{queue:false,duration:300});
	}, function() {
		$(".cover", this).stop().animate({left:'0px'},{queue:false,duration:300});
	});
	
	//Vertical Sliding
	$('.boxgrid.slidedown').hover(function(){
		$(".cover", this).stop().animate({top:'-216px'},{queue:false,duration:300});
	}, function() {
		$(".cover", this).stop().animate({top:'0px'},{queue:false,duration:300});
	});
	
	//Diagonal Sliding
	$('.boxgrid.thecombo').hover(function(){
		$(".cover", this).stop().animate({top:'260px', left:'325px'},{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({top:'90px'},{queue:false,duration:160});
	}, function() {
		$(".cover", this).stop().animate({top:'0px'},{queue:false,duration:160});
	});
	
	//Caption Sliding (Partially Hidden to Visible)
	$('.boxgrid.caption').hover(function(){
		$(".cover", this).stop().animate({top:'160px'},{queue:false,duration:160});
	}, function() {
		$(".cover", this).stop().animate({top:'220px'},{queue:false,duration:160});
	});
});
	
// SLIDE IN THE SLIDESHOW
// http://docs.jquery.com/UI/Effects/Slide
// http://www.learningjquery.com/2009/02/quick-tip-add-easing-to-your-animations
// http://www.commadot.com/jquery/easing.php

$(document).ready(function() {
	$("#slideshowContainer").show('slide', { direction: 'right' }, 350);
	//.animate({ right: 0 }, { queue: false, duration: '600', easing: 'easeInQuad' })
	//.slide().toggleLoop()
});

// WITHIN #SLIDESHOW SHOW CLIENT SLIDES
// http://www.malsup.com/jquery/cycle/pager3.html

$(document).ready( function() {
	$('#client').cycle({ 
    fx:     'scrollHorz', 
    speed:  'slow',
 	next:   '#client',
    timeout: 0, 
    pager:  '#picnav',
	queue: false,
	duration: 1000,
	easing: 'easeInQuad',
    pagerAnchorBuilder: function(idx, slide) {
        return '#picnav li:eq(' + idx + ') a';
    } 
	});
});

/* That's all folks! */