/*	ColorBox v1.3.1 - a full featured, light-weight, customizable lightbox based on jQuery 1.3 */
(function(A){var p="colorbox",n="hover",w=true,R=false,X,l=!A.support.opacity,T=l&&!window.XMLHttpRequest,W="click.colorbox",x="cbox_open",L="cbox_load",s="cbox_complete",K="cbox_cleanup",m="cbox_closed",O="resize.cbox_resize",I="resize.cboxie6 scroll.cboxie6",F,U,V,d,y,i,b,E,c,P,C,f,q,h,k,M,j,H,r,Y,g,e,a,v,N,o,z,Q,u,G,B={transition:"elastic",speed:350,width:R,height:R,initialWidth:"400",initialHeight:"400",maxWidth:R,maxHeight:R,scalePhotos:w,scrollbars:w,inline:R,html:R,iframe:R,photo:R,href:R,title:R,rel:R,opacity:0.9,preloading:w,current:"image {current} of {total}",previous:"previous",next:"next",close:"close",open:R,overlayClose:w,slideshow:R,slideshowAuto:w,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow"};function J(Z){if(Z.keyCode===37){Z.preventDefault();H.click()}else{if(Z.keyCode===39){Z.preventDefault();j.click()}}}function D(Z,aa){aa=aa==="x"?document.documentElement.clientWidth:document.documentElement.clientHeight;return(typeof Z==="string")?(Z.match(/%/)?(aa/100)*parseInt(Z,10):parseInt(Z,10)):Z}function t(Z){return Q.photo||Z.match(/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i)}function S(){for(var Z in Q){if(typeof(Q[Z])==="function"){Q[Z]=Q[Z].call(o)}}}X=A.fn.colorbox=function(aa,Z){if(this.length){this.each(function(){var ab=A(this).data(p)?A.extend({},A(this).data(p),aa):A.extend({},B,aa);A(this).data(p,ab).addClass("cboxelement")})}else{A(this).data(p,A.extend({},B,aa))}A(this).unbind(W).bind(W,function(ac){o=this;Q=A(o).data(p);S();A().bind("keydown.cbox_close",function(ad){if(ad.keyCode===27){ad.preventDefault();X.close()}});if(Q.overlayClose){F.css({cursor:"pointer"}).one("click",X.close)}o.blur();G=Z||R;var ab=Q.rel||o.rel;if(ab&&ab!=="nofollow"){c=A(".cboxelement").filter(function(){var ad=A(this).data(p).rel||this.rel;return(ad===ab)});z=c.index(o);if(z<0){c=c.add(o);z=c.length-1}}else{c=A(o);z=0}if(!u){u=w;A.event.trigger(x);r.html(Q.close);F.css({opacity:Q.opacity}).show();X.position(D(Q.initialWidth,"x"),D(Q.initialHeight,"y"),0);if(T){P.bind(I,function(){F.css({width:P.width(),height:P.height(),top:P.scrollTop(),left:P.scrollLeft()})}).trigger(I)}}X.slideshow();X.load();ac.preventDefault()});if(aa&&aa.open){A(this).triggerHandler(W)}return this};X.init=function(){function Z(aa){return A('<div id="cbox'+aa+'"/>')}P=A(window);U=A('<div id="colorbox"/>');F=Z("Overlay").hide();V=Z("Wrapper");d=Z("Content").append(C=Z("LoadedContent").css({width:0,height:0}),f=Z("LoadingOverlay"),q=Z("LoadingGraphic"),h=Z("Title"),k=Z("Current"),M=Z("Slideshow"),j=Z("Next"),H=Z("Previous"),r=Z("Close"));V.append(A("<div/>").append(Z("TopLeft"),y=Z("TopCenter"),Z("TopRight")),A("<div/>").append(i=Z("MiddleLeft"),d,b=Z("MiddleRight")),A("<div/>").append(Z("BottomLeft"),E=Z("BottomCenter"),Z("BottomRight"))).children().children().css({"float":"left"});A("body").prepend(F,U.append(V));if(l){U.addClass("cboxIE");if(T){F.css("position","absolute")}}d.children().addClass(n).mouseover(function(){A(this).addClass(n)}).mouseout(function(){A(this).removeClass(n)}).hide();Y=y.height()+E.height()+d.outerHeight(w)-d.height();g=i.width()+b.width()+d.outerWidth(w)-d.width();e=C.outerHeight(w);a=C.outerWidth(w);U.css({"padding-bottom":Y,"padding-right":g}).hide();j.click(X.next);H.click(X.prev);r.click(X.close);d.children().removeClass(n)};X.position=function(ac,ab,aa,ad){var ae=document.documentElement.clientHeight,ag=ae/2-ab/2,af=document.documentElement.clientWidth/2-ac/2,Z;if(ab>ae){ag-=(ab-ae)}if(ag<0){ag=0}if(af<0){af=0}ag+=P.scrollTop();af+=P.scrollLeft();ac=ac-g;ab=ab-Y;Z=(U.width()===ac&&U.height()===ab)?0:aa;V[0].style.width=V[0].style.height="9999px";function ah(ai){y[0].style.width=E[0].style.width=d[0].style.width=ai.style.width;q[0].style.height=f[0].style.height=d[0].style.height=i[0].style.height=b[0].style.height=ai.style.height}U.dequeue().animate({height:ab,width:ac,top:ag,left:af},{duration:Z,complete:function(){ah(this);V[0].style.width=(ac+g)+"px";V[0].style.height=(ab+Y)+"px";if(ad){ad()}},step:function(){ah(this)}})};X.resize=function(ae){if(!u){return}var aa,al,af,ad,ab,ah,am,Z,aj,ac=Q.transition==="none"?0:Q.speed;P.unbind(O);if(!ae){aj=setTimeout(function(){al=C.children().outerHeight(w);C[0].style.height=al+"px";X.position(C.width()+a+g,al+e+Y,ac)},1);return}C.remove();C=A(ae);function ai(){aa=Q.width?v:v&&v<C.width()?v:C.width();return aa}function ag(){al=Q.height?N:N&&N<C.height()?N:C.height();return al}if(!Q.scrollbars){C.css({overflow:"hidden"})}C.hide().appendTo("body").attr({id:"cboxLoadedContent"}).css({width:ai()}).css({height:ag()}).prependTo(d);if(T){A("select:not(#colorbox select)").filter(function(){return A(this).css("visibility")!=="hidden"}).css({visibility:"hidden"}).one(K,function(){A(this).css({visibility:"inherit"})})}Z=A("#cboxPhoto")[0];if(Z&&Q.height){af=(al-parseInt(Z.style.height,10))/2;Z.style.marginTop=(af>0?af:0)+"px"}function ak(ao){var an=aa+a+g,ap=al+e+Y;A().unbind("keydown",J);X.position(an,ap,ao,function(){if(!u){return}if(l){if(Z){C.fadeIn(100)}U[0].style.removeAttribute("filter")}d.children().show();A("#cboxIframeTemp").after("<iframe id='cboxIframe' name='iframe_"+new Date().getTime()+"' frameborder=0 src='"+(Q.href||o.href)+"' />").remove();f.hide();q.hide();M.hide();if(c.length>1){k.html(Q.current.replace(/\{current\}/,z+1).replace(/\{total\}/,c.length));j.html(Q.next);H.html(Q.previous);A().bind("keydown",J);if(Q.slideshow){M.show()}}else{k.hide();j.hide();H.hide()}h.html(Q.title||o.title);A.event.trigger(s);if(G){G.call(o)}if(Q.transition==="fade"){U.fadeTo(ac,1,function(){if(l){U[0].style.removeAttribute("filter")}})}P.bind(O,function(){X.position(an,ap,0)})})}if((Q.transition==="fade"&&U.fadeTo(ac,0,function(){ak(0)}))||ak(ac)){}if(Q.preloading&&c.length>1){ad=z>0?c[z-1]:c[c.length-1];ah=z<c.length-1?c[z+1]:c[0];am=A(ah).data(p).href||ah.href;ab=A(ad).data(p).href||ad.href;if(t(am)){A("<img />").attr("src",am)}if(t(ab)){A("<img />").attr("src",ab)}}};X.load=function(){var Z,ad,aa,ac,ab=X.resize;o=c[z];Q=A(o).data(p);S();A.event.trigger(L);Z=Q.height?D(Q.height,"y")-e-Y:R;ad=Q.width?D(Q.width,"x")-a-g:R;aa=Q.href||o.href;f.show();q.show();r.show();if(Q.maxHeight){N=Q.maxHeight?D(Q.maxHeight,"y")-e-Y:R;Z=Z&&Z<N?Z:N}if(Q.maxWidth){v=Q.maxWidth?D(Q.maxWidth,"x")-a-g:R;ad=ad&&ad<v?ad:v}N=Z;v=ad;if(Q.inline){A('<div id="cboxInlineTemp" />').hide().insertBefore(A(aa)[0]).bind(L+" "+K,function(){C.children().insertBefore(this);A(this).remove()});ab(A(aa).wrapAll("<div/>").parent())}else{if(Q.iframe){ab(A("<div><div id='cboxIframeTemp' /></div>"))}else{if(Q.html){ab(A("<div/>").html(Q.html))}else{if(t(aa)){ac=new Image();ac.onload=function(){ac.onload=null;if((N||v)&&Q.scalePhotos){var ag=this.width,ae=this.height,ai=0,ah=this,af=function(){ae+=ae*ai;ag+=ag*ai;ah.height=ae;ah.width=ag};if(v&&ag>v){ai=(v-ag)/ag;af()}if(N&&ae>N){ai=(N-ae)/ae;af()}}ab(A("<div />").css({width:this.width,height:this.height}).append(A(this).css({width:this.width,height:this.height,display:"block",margin:"auto",border:0}).attr("id","cboxPhoto")));if(c.length>1){A(this).css({cursor:"pointer"}).click(X.next)}if(l){this.style.msInterpolationMode="bicubic"}};ac.src=aa}else{A("<div />").load(aa,function(ae,af){if(af==="success"){ab(A(this))}else{ab(A("<p>Request unsuccessful.</p>"))}})}}}}};X.next=function(){z=z<c.length-1?z+1:0;X.load()};X.prev=function(){z=z>0?z-1:c.length-1;X.load()};X.slideshow=function(){var aa,Z,ab="cboxSlideshow_";M.bind(K,function(){clearTimeout(Z);M.unbind(s+" "+L+" click")});function ac(){M.text(Q.slideshowStop).bind(s,function(){Z=setTimeout(X.next,Q.slideshowSpeed)}).bind(L,function(){clearTimeout(Z)}).one("click",function(){aa();A(this).removeClass(n)});U.removeClass(ab+"off").addClass(ab+"on")}aa=function(){clearTimeout(Z);M.text(Q.slideshowStart).unbind(s+" "+L).one("click",function(){ac();Z=setTimeout(X.next,Q.slideshowSpeed);A(this).removeClass(n)});U.removeClass(ab+"on").addClass(ab+"off")};if(Q.slideshow&&c.length>1){if(Q.slideshowAuto){ac()}else{aa()}}};X.close=function(){A.event.trigger(K);u=R;A().unbind("keydown",J).unbind("keydown.cbox_close");P.unbind(O+" "+I);F.css({cursor:"auto"}).fadeOut("fast");U.stop(w,R).fadeOut("fast",function(){C.remove();U.css({opacity:1});d.children().hide();A.event.trigger(m)})};X.element=function(){return o};X.settings=B;A(X.init)}(jQuery));

$(function(){

	// HOMEPAGE 

	$('.teaser').hover (
		function () {$(this).addClass('hover');},
		function () {$('.teaser').removeClass('hover');}
	);

	$('#student img').click(
			function () {
				$(this).hide();
			$('#student').flash(
		    { src: '/media/Home/student.swf',width:320,height:285},
		    { version:8,update:false }
			);
		}
	);

	// THEMES

	$('.thumbs a').colorbox({width:667,height:510,transition:'fade',current:'Theme {current} of {total}'}).click(function(){
		var id = $(this).parent().attr('id');
		if (window.location.hash)
			window.location = "#"+id.substr(0,id.indexOf('-'));
	});

	$('#natemorgan img').click(
		function () {
			$(this).hide();
			$('#natemorgan').flash(
		    { src: '/media/NateMorgan/NateMorgan.swf',width:256,height:192,flashvars:{autoPlay:false}},
		    { version: 8,update: false }
			);
		}
	);

	$().bind('cbox_open', function(){
		$('#natemorgan').addClass('massivelyindented');
		
	});

	$().bind('cbox_complete', function(){
		$('#cboxContent').addClass('open');
		$('#cboxLoadedContent').css('height','');
	});

	$().bind('cbox_closed', function(){
		$('#cboxContent').removeClass('open');
		$('#natemorgan').removeClass('massivelyindented');
	});

	$('.thumbs a').hover(
		function() {
			$('.thumbs li').removeClass('hover nonhover');
			$(this).parent().siblings().addClass('nonhover');
			$(this).parent().addClass('hover');
		},function() {
		}
	);

	$('.thumbs').hover(
		function() {},
		function() {
			setTimeout("$('.thumbs li').removeClass('hover nonhover')", 200);
		}
	);

	$('.theme #nav #theme li a').click(
		function() {
			var handle = $(this).parent().attr('id');
			$('#'+handle+'thumb a').trigger('click');
			return false;
		}
	);

	var hash = window.location.hash;
	if (hash) {
		$(hash+'-thumb a').trigger('click');
	}
});


/**
 * Flash (http://jquery.lukelutman.com/plugins/flash)
 * A jQuery plugin for embedding Flash movies.
 * 
 * Version 1.0
 * November 9th, 2006
 *
 * Copyright (c) 2006 Luke Lutman (http://www.lukelutman.com)
 * Dual licensed under the MIT and GPL licenses.
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.opensource.org/licenses/gpl-license.php
 * 
 * Inspired by:
 * SWFObject (http://blog.deconcept.com/swfobject/)
 * UFO (http://www.bobbyvandersluis.com/ufo/)
 * sIFR (http://www.mikeindustries.com/sifr/)
 * 
 * IMPORTANT: 
 * The packed version of jQuery breaks ActiveX control
 * activation in Internet Explorer. Use JSMin to minifiy
 * jQuery (see: http://jquery.lukelutman.com/plugins/flash#activex).
 *
 **/ 
;(function(){
	
var $$;

/**
 * 
 * @desc Replace matching elements with a flash movie.
 * @author Luke Lutman
 * @version 1.0.1
 *
 * @name flash
 * @param Hash htmlOptions Options for the embed/object tag.
 * @param Hash pluginOptions Options for detecting/updating the Flash plugin (optional).
 * @param Function replace Custom block called for each matched element if flash is installed (optional).
 * @param Function update Custom block called for each matched if flash isn't installed (optional).
 * @type jQuery
 *
 * @cat plugins/flash
 * 
 * @example $('#hello').flash({ src: 'hello.swf' });
 * @desc Embed a Flash movie.
 *
 * @example $('#hello').flash({ src: 'hello.swf' }, { version: 8 });
 * @desc Embed a Flash 8 movie.
 *
 * @example $('#hello').flash({ src: 'hello.swf' }, { expressInstall: true });
 * @desc Embed a Flash movie using Express Install if flash isn't installed.
 *
 * @example $('#hello').flash({ src: 'hello.swf' }, { update: false });
 * @desc Embed a Flash movie, don't show an update message if Flash isn't installed.
 *
**/
$$ = jQuery.fn.flash = function(htmlOptions, pluginOptions, replace, update) {
	
	// Set the default block.
	var block = replace || $$.replace;
	
	// Merge the default and passed plugin options.
	pluginOptions = $$.copy($$.pluginOptions, pluginOptions);
	
	// Detect Flash.
	if(!$$.hasFlash(pluginOptions.version)) {
		// Use Express Install (if specified and Flash plugin 6,0,65 or higher is installed).
		if(pluginOptions.expressInstall && $$.hasFlash(6,0,65)) {
			// Add the necessary flashvars (merged later).
			var expressInstallOptions = {
				flashvars: {  	
					MMredirectURL: location,
					MMplayerType: 'PlugIn',
					MMdoctitle: jQuery('title').text() 
				}					
			};
		// Ask the user to update (if specified).
		} else if (pluginOptions.update) {
			// Change the block to insert the update message instead of the flash movie.
			block = update || $$.update;
		// Fail
		} else {
			// The required version of flash isn't installed.
			// Express Install is turned off, or flash 6,0,65 isn't installed.
			// Update is turned off.
			// Return without doing anything.
			return this;
		}
	}
	
	// Merge the default, express install and passed html options.
	htmlOptions = $$.copy($$.htmlOptions, expressInstallOptions, htmlOptions);
	
	// Invoke $block (with a copy of the merged html options) for each element.
	return this.each(function(){
		block.call(this, $$.copy(htmlOptions));
	});
	
};
/**
 *
 * @name flash.copy
 * @desc Copy an arbitrary number of objects into a new object.
 * @type Object
 * 
 * @example $$.copy({ foo: 1 }, { bar: 2 });
 * @result { foo: 1, bar: 2 };
 *
**/
$$.copy = function() {
	var options = {}, flashvars = {};
	for(var i = 0; i < arguments.length; i++) {
		var arg = arguments[i];
		if(arg == undefined) continue;
		jQuery.extend(options, arg);
		// don't clobber one flash vars object with another
		// merge them instead
		if(arg.flashvars == undefined) continue;
		jQuery.extend(flashvars, arg.flashvars);
	}
	options.flashvars = flashvars;
	return options;
};
/*
 * @name flash.hasFlash
 * @desc Check if a specific version of the Flash plugin is installed
 * @type Boolean
 *
**/
$$.hasFlash = function() {
	// look for a flag in the query string to bypass flash detection
	if(/hasFlash\=true/.test(location)) return true;
	if(/hasFlash\=false/.test(location)) return false;
	var pv = $$.hasFlash.playerVersion().match(/\d+/g);
	var rv = String([arguments[0], arguments[1], arguments[2]]).match(/\d+/g) || String($$.pluginOptions.version).match(/\d+/g);
	for(var i = 0; i < 3; i++) {
		pv[i] = parseInt(pv[i] || 0);
		rv[i] = parseInt(rv[i] || 0);
		// player is less than required
		if(pv[i] < rv[i]) return false;
		// player is greater than required
		if(pv[i] > rv[i]) return true;
	}
	// major version, minor version and revision match exactly
	return true;
};
/**
 *
 * @name flash.hasFlash.playerVersion
 * @desc Get the version of the installed Flash plugin.
 * @type String
 *
**/
$$.hasFlash.playerVersion = function() {
	// ie
	try {
		try {
			// avoid fp6 minor version lookup issues
			// see: http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/
			var axo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash.6');
			try { axo.AllowScriptAccess = 'always';	} 
			catch(e) { return '6,0,0'; }				
		} catch(e) {}
		return new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version').replace(/\D+/g, ',').match(/^,?(.+),?$/)[1];
	// other browsers
	} catch(e) {
		try {
			if(navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin){
				return (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]).description.replace(/\D+/g, ",").match(/^,?(.+),?$/)[1];
			}
		} catch(e) {}		
	}
	return '0,0,0';
};
/**
 *
 * @name flash.htmlOptions
 * @desc The default set of options for the object or embed tag.
 *
**/
$$.htmlOptions = {
	height: 240,
	flashvars: {},
	pluginspage: 'http://www.adobe.com/go/getflashplayer',
	src: '#',
	type: 'application/x-shockwave-flash',
	width: 320		
};
/**
 *
 * @name flash.pluginOptions
 * @desc The default set of options for checking/updating the flash Plugin.
 *
**/
$$.pluginOptions = {
	expressInstall: false,
	update: true,
	version: '6.0.65'
};
/**
 *
 * @name flash.replace
 * @desc The default method for replacing an element with a Flash movie.
 *
**/
$$.replace = function(htmlOptions) {
	this.innerHTML = '<div class="alt">'+this.innerHTML+'</div>';
	jQuery(this)
		.addClass('flash-replaced')
		.prepend($$.transform(htmlOptions));
};
/**
 *
 * @name flash.update
 * @desc The default method for replacing an element with an update message.
 *
**/
$$.update = function(htmlOptions) {
	var url = String(location).split('?');
	url.splice(1,0,'?hasFlash=true&');
	url = url.join('');
	var msg = '<p>This content requires the Flash Player. <a href="http://www.adobe.com/go/getflashplayer">Download Flash Player</a>. Already have Flash Player? <a href="'+url+'">Click here.</a></p>';
	this.innerHTML = '<span class="alt">'+this.innerHTML+'</span>';
	jQuery(this)
		.addClass('flash-update')
		.prepend(msg);
};
/**
 *
 * @desc Convert a hash of html options to a string of attributes, using Function.apply(). 
 * @example toAttributeString.apply(htmlOptions)
 * @result foo="bar" foo="bar"
 *
**/
function toAttributeString() {
	var s = '';
	for(var key in this)
		if(typeof this[key] != 'function')
			s += key+'="'+this[key]+'" ';
	return s;		
};
/**
 *
 * @desc Convert a hash of flashvars to a url-encoded string, using Function.apply(). 
 * @example toFlashvarsString.apply(flashvarsObject)
 * @result foo=bar&foo=bar
 *
**/
function toFlashvarsString() {
	var s = '';
	for(var key in this)
		if(typeof this[key] != 'function')
			s += key+'='+encodeURIComponent(this[key])+'&';
	return s.replace(/&$/, '');		
};
/**
 *
 * @name flash.transform
 * @desc Transform a set of html options into an embed tag.
 * @type String 
 *
 * @example $$.transform(htmlOptions)
 * @result <embed src="foo.swf" ... />
 *
 * Note: The embed tag is NOT standards-compliant, but it 
 * works in all current browsers. flash.transform can be
 * overwritten with a custom function to generate more 
 * standards-compliant markup.
 *
**/
$$.transform = function(htmlOptions) {
	htmlOptions.toString = toAttributeString;
	if(htmlOptions.flashvars) htmlOptions.flashvars.toString = toFlashvarsString;
	return '<embed ' + String(htmlOptions) + '/>';		
};

/**
 *
 * Flash Player 9 Fix (http://blog.deconcept.com/2006/07/28/swfobject-143-released/)
 *
**/
if (window.attachEvent) {
	window.attachEvent("onbeforeunload", function(){
		__flash_unloadHandler = function() {};
		__flash_savedUnloadHandler = function() {};
	});
}
	
})();