// twitterlib.js (c) 2009 Remy Sharp
// Licensed under the terms of the MIT license.
(function(f,l){function C(b){var a='<li><div class="tweet">';a+='<div class="vcard"><a href="http://twitter.com/'+b.user.screen_name+'" class="url" target="_blank"><img style="height: 48px; width: 48px;" alt="'+b.user.name+'" class="photo fn" height="48" src="'+b.user.profile_image_url+'" width="48" /></a></div>';a+='<div class="hentry"><strong><a href="http://twitter.com/';a+=b.user.screen_name+'" ';a+='title="'+b.user.name+'" target="_blank">'+b.user.screen_name+"</a></strong> ";a+='<span class="entry-content">';a+=l[f].ify.clean(b.text);
a+='</span> <span class="meta entry-meta"><a href="http://twitter.com/'+b.user.screen_name;a+="/status/"+b.id+'" class="entry-date" rel="bookmark" target="_blank"><span class="published" title="';a+=b.created_at+'">'+l[f].time.datetime(b.created_at)+"</span></a>";if(b.source)a+=" <span>from "+b.source+"</span>";a+="</span></div></div></li>";return a}function u(b){s.getElementById(f+b)&&x.removeChild(s.getElementById(f+b));delete t[f+b];m[f+b]=n;try{delete m[f+b]}catch(a){}}function y(b,a,d){var c=s.createElement("script"),
e=null;if(a==n)a={};o++;t[f+o]=true;m[f+o]=function(k,h){return function(g){var i=0,p=[];if(g.results){g=g.results;for(i=g.length;i--;){g[i].user={id:g[i].from_user_id,screen_name:g[i].from_user,profile_image_url:g[i].profile_image_url};g[i].source=l[f].ify.entities(g[i].source);p=g[i].created_at.split(" ");g[i].created_at=[p[0],p[2],p[1],p[4],p[5],p[3]].join(" ").replace(/,/,"")}}else if(g.length&&g[0].sender)for(i=g.length;i--;){g[i].user=g[i].sender;g[i].originalText=g[i].text;g[i].text="@"+g[i].recipient_screen_name+
" "+g[i].text}h.originalTweets=g;if(h.filter)g=z.matchTweets(g,h.filter);if(q&&h.page>1){sessionStorage.setItem(f+".page"+h.page,"true");sessionStorage.setItem(f+".page"+h.page+".tweets",JSON.stringify(g));sessionStorage.setItem(f+".page"+h.page+".originalTweets",JSON.stringify(h.originalTweets))}h.cached=false;d.call(l[f],g,h);u(k)}}(o,a);e=b.match(/callback=(.*)/);if(e!=null&&e.length>1)m[e[1]]=m[f+o];else b+="&callback="+f+o;if(!q||a.page<=1||q&&sessionStorage.getItem(f+".page"+a.page)==null){c.src=
b;c.id=f+o;x.appendChild(c)}else if(q){u(o);a.cached=true;a.originalTweets=JSON.parse(sessionStorage.getItem(f+".page"+a.page+".originalTweets"));d.call(l[f],JSON.parse(sessionStorage.getItem(f+".page"+a.page+".tweets")),a)}}function A(b,a){return r[b].replace(/(\b.*?)%(.*?)(\|.*?)?%/g,function(d,c,e,k){if(k&&k.substr(1)=="remove"&&a[e]==n)return"";return c+(a[e]===n?k.substr(1):a[e])})}function v(b,a){if(typeof b=="function"){a=b;b={}}if(b===n)b={};b.page=b.page||1;b.callback=a;b.limit===0&&delete b.limit;
return b}function w(b,a,d){j={method:b,arg:a,options:d,callback:d.callback,page:d.page||1};if(q){b=JSON.parse(sessionStorage.getItem(f+".last_request")||"{}");if(j.method!=b.method||j.arg!=b.arg){D();sessionStorage.setItem(f+".last_request",JSON.stringify(j))}}}function D(){for(var b=sessionStorage.length;b--;)sessionStorage.key(b).substr(0,f.length)==f&&sessionStorage.removeItem(sessionStorage.key(b))}function E(b,a){if(a&&r[b]==n)r[b]=a;if(this[b]==n)this[b]=function(d,c,e){if(typeof d=="function"){e=
d;d=""}else if(d.toString()=="[Object object]"){e=c;c=d;d=""}c=v(c,e);w(b,d,c);c[b]=c.user=d;c.search=encodeURIComponent(d);c.callback&&y(A(b,c),c,c.callback);return this};return this[b]}var o=+new Date,m=this,s=m.document,x=s.getElementsByTagName("head")[0],j={},t={},F={"&quot;":'"',"&lt;":"<","&gt;":">"},B={search:"http://search.twitter.com/search.json?q=%search%&page=%page|1%&rpp=%limit|100%&since_id=%since|remove%",timeline:"http://twitter.com/statuses/user_timeline/%user%.json?count=%limit|200%&page=%page|1%&since_id=%since|remove%",
list:"http://api.twitter.com/1/%user%/lists/%list%/statuses.json?page=%page|1%&per_page=%limit|200%&since_id=%since|remove%",favs:"http://twitter.com/favorites/%user%.json?page=%page|1%"},r=B,n,q=false,G=function(){return{entities:function(b){return b.replace(/(&[a-z0-9]+;)/g,function(a){return F[a]})},link:function(b){return b.replace(/[a-z]+:\/\/[a-z0-9-_]+\.[a-z0-9-_:~\+#%&\?\/.=]+[^:\.,\)\s*$]/ig,function(a){return'<a href="'+a+'" target="_blank">'+(a.length>25?a.substr(0,24)+"...":a)+"</a>"})},at:function(b){return b.replace(/(^|[^\w]+)\@([a-zA-Z0-9_]{1,15}(\/[a-zA-Z0-9-_]+)*)/g,
function(a,d,c){return d+'@<a href="http://twitter.com/'+c+'" target="_blank">'+c+"</a>"})},hash:function(b){return b.replace(/(^|[^&\w'"]+)\#([a-zA-Z0-9_]+)/g,function(a,d,c){return d+'#<a href="http://search.twitter.com/search?q=%23'+c+'" target="_blank">'+c+"</a>"})},clean:function(b){return this.hash(this.at(this.link(b)))}}}(),H=function(){var b=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return{time:function(a){var d=a.getHours();a=a.getMinutes()+"";var c="AM";if(d==0)d=12;else if(d==12)c="PM";
else if(d>12){d-=12;c="PM"}if(a.length==1)a="0"+a;return d+":"+a+" "+c},date:function(a){a.toDateString().split(/ /);var d=b[a.getMonth()],c=a.getDate()+"",e=~~c;a=a.getFullYear();var k=(new Date).getFullYear(),h="th";if(e%10==1&&c.substr(0,1)!="1")h="st";else if(e%10==2&&c.substr(0,1)!="1")h="nd";else if(e%10==3&&c.substr(0,1)!="1")h="rd";if(c.substr(0,1)=="0")c=c.substr(1);return d+" "+c+h+(k!=a?", "+a:"")},datetime:function(a){a=a.split(" ");a=new Date(Date.parse(a[1]+" "+a[2]+", "+a[5]+" "+a[3]));
return this.time(a)+" "+this.date(a)},relative:function(a){var d=a.split(" "),c=Date.parse(d[1]+" "+d[2]+", "+d[5]+" "+d[3]);d=new Date(c);var e=arguments.length>1?arguments[1]:new Date;c=~~((e.getTime()-c)/1E3);var k="";c+=e.getTimezoneOffset()*60;return k=c<5?"less than 5 seconds ago":c<30?"half a minute ago":c<60?"less than a minute ago":c<120?"1 minute ago":c<2700?(~~(c/60)).toString()+" minutes ago":c<10800?"about 1 hour ago":c<86400?"about "+(~~(c/3600)).toString()+" hours ago":c<172800?this.time(d)+
" yesterday":this.time(d)+" "+this.date(d)}}}(),z=function(){return{match:function(b,a){var d=0,c="",e=b.text.toLowerCase();if(typeof a=="string")a=this.format(a);if(a.not.length){for(d=0;d<a.not.length;d++)if(e.indexOf(a.not[d])!==-1)return false;if(!a.and.length&&!a.or.length)return true}if(a.and.length)for(d=0;d<a.and.length;d++){c=a.and[d];if(c.substr(0,3)==="to:"){if(!RegExp("^@"+c.substr(3)).test(e))return false}else if(c.substr(0,5)=="from:"){if(b.user.screen_name!==c.substr(5))return false}else if(e.indexOf(c)===
-1)return false}if(a.or.length)for(d=0;d<a.or.length;d++){c=a.or[d];if(c.substr(0,3)==="to:"){if(RegExp("^@"+c.substr(3)).test(e))return true}else if(c.substr(0,5)=="from:"){if(b.user.screen_name===c.substr(5))return true}else if(e.indexOf(a.or[d])!==-1)return true}else if(a.and.length)return true;return false},format:function(b){var a=[],d=[],c=[],e=0,k=[];b.replace(/(-?["'](.*?)["']|\S+\b)/g,function(h){var g=false;if(h.substr(0,1)=="-")g=true;h=h.replace(/["']+|["']+$/g,"");g?k.push(h.substr(1).toLowerCase()):
a.push(h)});for(e=0;e<a.length;e++)if(a[e]=="OR"&&a[e+1]){d.push(a[e-1].toLowerCase());d.push(a[e+1].toLowerCase());e++;c.pop()}else c.push(a[e].toLowerCase());return{or:d,and:c,not:k}},matchTweets:function(b,a,d){var c=[],e=0;if(typeof a=="string")a=this.format(a);for(e=0;e<b.length;e++)this.match(b[e],a,d)&&c.push(b[e]);return c}}}();l[f]={custom:E,status:function(b,a,d){a=v(a,d);a.limit=1;w("status",b,a);return this.timeline(b,a,a.callback)},list:function(b,a,d){var c=b.split("/");a=v(a,d);w("list",
b,a);a.user=c[0];a.list=c[1];a.callback&&y(A("list",a),a,a.callback);return this},next:function(){if(j.method){j.page++;j.options.page=j.page;this[j.method](j.arg,j.options,j.callback)}return this},time:H,ify:G,filter:z,cancel:function(){for(var b in t)m[b]=function(){return function(a){u(a)}}(b.replace(f,""));t={};return this},reset:function(){r=B;j.method=""},render:C,debug:function(b){for(var a in b)r[a]=b[a];return this},cache:function(b){q=b==n?true:b;if(!m.JSON||!m.sessionStorage)q=false}};
l[f].custom("search");l[f].custom("timeline");l[f].custom("favs")})("twitterlib",this);

/*
 * jTube
 * http://jtube.monkeecreate.com
 * 
 * jQuery Youtube API Feed Plugin
 * 
 * Developed by John Hoover <john@defvayne23.com>
 * Another project from monkeeCreate <http://monkeecreate.com>
 *
 * Version 1.3.6 - Last updated: May 25, 2010
*/
(function($){$.extend({jTube:function(i){var i=$.extend({user:'',userType:'uploads',search:'',feed:'',playlist:'',format:'flash',order:'published',time:'all_time',limit:5,page:1,success:function(a,b){},error:function(a){}},i);var j='http://gdata.youtube.com/feeds/';var k=this;var l='';if(i.user!='')j+='api/users/'+i.user+'/'+i.userType+'?';else if(i.search!='')j+='api/videos?q='+i.search+'&';else if(i.feed!='')j+='api/standardfeeds/'+i.feed+'?';else if(i.playlist!='')j+='api/playlists/'+i.playlist+'?';else{i.error("No feed choices given.");return false}j+='alt=json-in-script';j+='&max-results='+i.limit;j+='&start-index='+(((i.page*i.limit)-i.limit)+1);j+='&orderby='+i.order;j+='&time='+i.time;if(i.format=="mpeg")j+='&format=6';else if(i.format=="h263")j+='&format=1';else j+='&format=5';j+='&callback=?';$.getJSON(j,function(d){if(d!=''&&d!=null){if(i.user!=''&&i.userType=='playlists'){var e=[];$(d.feed.entry).each(function(){var a={title:this.title.$t,description:this.yt$description.$t,id:this.yt$playlistId.$t,link:this.link[1].href,published:new Date(this.published.$t)};e[e.length]=a});var f=e}else if(i.user!=''&&i.userType=='subscriptions'){var g=[];$(d.feed.entry).each(function(){var a={title:this.title.$t,username:this.yt$username.$t,link:this.link[1].href,thumbnail:this.media$thumbnail.url,published:new Date(this.published.$t),updated:new Date(this.updated.$t)};g[g.length]=a});var f=g}else if(i.user!=''&&i.userType=='contacts'){var h=[];$(d.feed.entry).each(function(){var a={username:this.yt$username.$t,status:this.yt$status.$t,link:this.link[1].href};h[h.length]=a});var f=h}else{var f=[];$(d.feed.entry).each(function(){var b=[];$(this.category).each(function(a){if(a!=0){b[a-1]=this.term}});var c={title:this.title.$t,link:this.link[0].href,categories:b,author:{name:this.author[0].name.$t,link:this.author[0].uri.$t}};if(this.media$group.media$description){c.description=this.media$group.media$description.$t}if(this.media$group.media$thumbnail){c.thumbnail=this.media$group.media$thumbnail[3].url}videoFormats=[];$(this.media$group.media$content).each(function(){videoFormats[this.yt$format]=this.url});if(i.format=="mpeg")c.video=videoFormats[6];else if(i.format=="h263")c.video=videoFormats[1];else c.video=videoFormats[5];if(this.published)c.published=new Date(this.published.$t);if(this.media$group.yt$duration){duration=this.media$group.yt$duration.seconds;hours=0;minutes=0;seconds=0;while(duration>=3600){hours=hours+1;duration=duration-3600}while(duration>=60){minutes=minutes+1;duration=duration-60}seconds=duration;if(seconds<10)seconds='0'+seconds;c.length=minutes+':'+seconds;if(hours>0)c.length=hours+':'+c.length}if(this.yt$statistics)c.views=this.yt$statistics.viewCount;f[f.length]=c})}pages=Math.ceil(d.feed.openSearch$totalResults.$t/i.limit);i.success(f,pages)}else{i.error("Bad request.")}});return this},jTubeEmbed:function(a,b){var b=$.extend({width:290,height:250,autoplay:true,fullscreeen:false,related:true,loop:false,keyboard:true,genie:false,border:false,highdef:true,start:0},b);var c=a+"?";c+='autoplay='+(b.autoPlay?1:0);c+='&fs='+(b.fullscreen?1:0);c+='&rl=1'+(b.related?1:0);c+='&loop=1'+(b.loop?1:0);c+='&disablekb=0'+(b.keyboard?0:1);c+='&egm=1'+(b.genie?1:0);c+='&border=1'+(b.border?1:0);c+='&hd=1'+(b.highdef?1:0);c+='&start='+b.start;var d='<object width="'+b.width+'" height="'+b.height+'">';d+='<param name="movie" value="'+c+'"</param>';d+='<param name="allowScriptAccess" value="always"></param>';if(b.fullscreen==true)d+='<param name="allowFullScreen" value="true"></param>';d+='<embed src="'+c+'"';d+='    type="application/x-shockwave-flash"';if(b.fullscreen==true)d+='    allowfullscreen="true"';d+='    allowscriptaccess="always"';d+='    width="'+b.width+'" height="'+b.height+'">';d+='    </embed>';d+='</object>';return d}})})(jQuery);
/*
 * InnerFade
*/
(function(a){a.fn.innerfade=function(b){return this.each(function(){a.innerfade(this,b)})};a.innerfade=function(b,c){var e={animationtype:"fade",speed:"normal",type:"sequence",timeout:2000,containerheight:"auto",runningclass:"innerfade",children:null};if(c){a.extend(e,c)}if(e.children===null){var g=a(b).children()}else{var g=a(b).children(e.children)}if(g.length>1){a(b).css("position","relative").css("height",e.containerheight).addClass(e.runningclass);for(var d=0;d<g.length;d++){a(g[d]).css("z-index",String(g.length-d)).css("position","absolute").hide()}if(e.type=="sequence"){setTimeout(function(){a.innerfade.next(g,e,1,0)},e.timeout);a(g[0]).show()}else{if(e.type=="random"){var f=Math.floor(Math.random()*(g.length));setTimeout(function(){do{h=Math.floor(Math.random()*(g.length))}while(f==h);a.innerfade.next(g,e,h,f)},e.timeout);a(g[f]).show()}else{if(e.type=="random_start"){e.type="sequence";var h=Math.floor(Math.random()*(g.length));setTimeout(function(){a.innerfade.next(g,e,(h+1)%g.length,h)},e.timeout);a(g[h]).show()}else{alert("Innerfade-Type must either be 'sequence', 'random' or 'random_start'")}}}}};a.innerfade.next=function(d,b,e,c){if(b.animationtype=="slide"){a(d[c]).slideUp(b.speed);a(d[e]).slideDown(b.speed)}else{if(b.animationtype=="fade"){a(d[c]).fadeOut(b.speed);a(d[e]).fadeIn(b.speed,function(){removeFilter(a(this)[0])})}else{alert("Innerfade-animationtype must either be 'slide' or 'fade'")}}if(b.type=="sequence"){if((e+1)<d.length){e=e+1;c=e-1}else{e=0;c=d.length-1}}else{if(b.type=="random"){c=e;while(e==c){e=Math.floor(Math.random()*d.length)}}else{alert("Innerfade-Type must either be 'sequence', 'random' or 'random_start'")}}setTimeout((function(){a.innerfade.next(d,b,e,c)}),b.timeout)}})(jQuery);function removeFilter(a){if(a.style.removeAttribute){a.style.removeAttribute("filter")}};

/*
 * labelswitch
*/
(function(c){c.fn.labelswitch=function(){return this.each(function(){var b=c(this);b.addClass("label_active");b.attr("label",b.prev("label").text());b.val(b.prev("label").text());b.focus(function(){var a=c(this);if(a.val()==""||a.val()==a.attr("label"))a.val("")}).blur(function(){var a=c(this);a.val()==""&&a.val(a.attr("label"))})})}})(jQuery);
/*
 * Generic Helper functions
*/
window.log = function(){
	/*
	log.history = log.history || [];
  	log.history.push(arguments);
  	if(window.console){
    	try{
    		console.log.apply(window,Array.prototype.slice.call(arguments));
    	} catch(e){ console.log(arguments) }
  	}
  	*/
  	return false;
};
(function($){ 
	$.fn.exists = function () {
		return this.length > 0;
	}
})(jQuery);
(function($){ 
	$.fn.scrollTo = function () {
		var $t = $(this);
	    var y = $t.offset().top;
	    if($('html, body').scrollTop() < y) {
	        $('html, body').stop().animate({scrollTop: y - 20}, 1000, 'swing');
	    }
	}
})(jQuery);
(function($) {
	$.fn.overflowList = function(settings) {

		settings = $.extend({
			inital: 4,
			increment: 5
		}, settings || {});

		return this.each(function() {

			var $this = $(this);

		  	// main plugin functionality
		  	var $items = $this.children();
		  	var $more = $('<a href="#" class="overflow-more">Show More Courses</a>');
		  	var limit = settings.increment;


		  	if ($items.length - 1 > settings.inital) {

				$('div:gt(' + settings.inital + ')', $this).hide();

				$this.append($more);

				$more.click(function(e){

					$('div:eq(' + limit + ')', $this).addClass('limit');

					limit += settings.increment;
					$('div:lt(' + limit + ')', $this).fadeIn();

					if (limit > $items.length) {
						$(this).hide();
					}
					e.preventDefault();
				});

			}


		});
	};
})(jQuery);

