// JavaScript Document

// JavaScript Document

/***** EASING *****/

jQuery.easing.jswing=jQuery.easing.swing;jQuery.extend(jQuery.easing,{def:"easeInOutQuad",swing:function(e,f,a,h,g){return jQuery.easing[jQuery.easing.def](e,f,a,h,g)},easeInQuad:function(e,f,a,h,g){return h*(f/=g)*f+a},easeOutQuad:function(e,f,a,h,g){return -h*(f/=g)*(f-2)+a},easeInOutQuad:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f+a}return -h/2*((--f)*(f-2)-1)+a},easeInQuint:function(e,f,a,h,g){return h*(f/=g)*f*f*f*f+a},easeOutQuint:function(e,f,a,h,g){return h*((f=f/g-1)*f*f*f*f+1)+a},easeInOutQuint:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f*f*f*f+a}return h/2*((f-=2)*f*f*f*f+2)+a},easeInExpo:function(e,f,a,h,g){return(f===0)?a:h*Math.pow(2,10*(f/g-1))+a},easeOutExpo:function(e,f,a,h,g){return(f==g)?a+h:h*(-Math.pow(2,-10*f/g)+1)+a},easeInOutExpo:function(e,f,a,h,g){if(f===0){return a}if(f==g){return a+h}if((f/=g/2)<1){return h/2*Math.pow(2,10*(f-1))+a}return h/2*(-Math.pow(2,-10*--f)+2)+a},easeInRegular:function(e,f,a,h,g){return h*(f/=g)*f+a},easeOutRegular:function(e,f,a,h,g){return -h*(f/=g)*(f-2)+a},easeInOutRegular:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f+a}return -h/2*((--f)*(f-2)-1)+a}});



function removeEmpty(){
	$('#midpic, #leftNav ul').each(function(){
		if($(this).find('> *').size() <= 0){
			$(this).remove();
		}
	});
}

function removeLast(){
        $('#bottomRight a:last').css("border-right","0");
}

/*
	 * jGFeed 1.0 - Google Feed API abstraction plugin for jQuery
	 *
	 * Copyright (c) 2009 jQuery HowTo
	 *
	 * Licensed under the GPL license:
	 *   http://www.gnu.org/licenses/gpl.html
	 *
	 * URL:
	 *   http://jquery-howto.blogspot.com
	 *
	 * Author URL:
	 *   http://me.boo.uz
	 *
	 */
	(function($){$.extend({jGFeed:function(url,fnk,num,key){if(url==null){return false;}var gurl="http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&callback=?&q="+url;if(num!=null){gurl+="&num="+num;}if(key!=null){gurl+="&key="+key;}$.getJSON(gurl,function(data){if(typeof fnk=="function"){fnk.call(this,data.responseData.feed);}else{return false;}});}});})(jQuery);
	dateArray = ['January', 'February', 'March', 'April' ,'May' ,'June' ,'July' ,'August' ,'September' ,'October' ,'November', 'December']
	$.jGFeed('http://www.cloudpro.co.uk/feeds/latest/rss',
	function(feeds){
		if(!feeds){
			return false;
		}
		for(var i=0; i<feeds.entries.length; i++){
			var entry = feeds.entries[i];
			var myDate = new Date(entry.publishedDate);
			var day = myDate.getDate();
			var month = dateArray[myDate.getMonth()]
			var year = myDate.getFullYear();
			var hours = myDate.getHours();
			var minutes = myDate.getMinutes();
			if (minutes < 10){
				minutes = "0" + minutes
			}
			if(hours > 11){
				minutes += 'pm';
			}
			else{
				minutes += 'am';
			}
			$('.rssNewselection').append('<li><strong class="rssDate">' + day + ' ' + month + ' </strong><br><span class="rssTitle">' + entry.title + '</span><br> <a target="_blank" href="'  + entry.link + '">' + 'more</a></li>')
		}
		
	}, 1);
	(function($){$.extend({jGFeed:function(url,fnk,num,key){if(url==null){return false;}var gurl="http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&callback=?&q="+url;if(num!=null){gurl+="&num="+num;}if(key!=null){gurl+="&key="+key;}$.getJSON(gurl,function(data){if(typeof fnk=="function"){fnk.call(this,data.responseData.feed);}else{return false;}});}});})(jQuery);
	dateArray = ['January', 'February', 'March', 'April' ,'May' ,'June' ,'July' ,'August' ,'September' ,'October' ,'November', 'December']
	$.jGFeed('http://feeds.pheedo.com/1260',
	function(feeds){
		if(!feeds){
			return false;
		}
		for(var i=0; i<feeds.entries.length; i++){
			var entry = feeds.entries[i];
			var myDate = new Date(entry.publishedDate);
			var day = myDate.getDate();
			var month = dateArray[myDate.getMonth()]
			var year = myDate.getFullYear();
			var hours = myDate.getHours();
			var minutes = myDate.getMinutes();
			if (minutes < 10){
				minutes = "0" + minutes
			}
			if(hours > 11){
				minutes += 'pm';
			}
			else{
				minutes += 'am';
			}
			$('.rssNewselectionb').append('<li><strong class="rssDate">' + day + ' ' + month + ' </strong><br><span class="rssTitle">' + entry.title + '</span><br> <a target="_blank" href="'  + entry.link + '">' + 'more</a></li>')
		}
		
	}, 1);


$(document).ready(function(){
	removeEmpty();
	removeLast()
	
	$('#seminar2').hide();
	$('#tab1 a').addClass('on');
	$('.seminar').each(function(){
		$(this).find('.semIndex a:first').addClass('on');
		$(this).find('.semContent .semList').not(':first').hide();
		$(this).find('.semContent > a').not(':first').hide();
		$(this).find('.semList li:even').addClass('even');
	});
	
	
	
	//  Tab changing for each day
	$('#semTabs a').click(function(){
		$('#semTabs a').removeClass('on');
		$(this).addClass('on');
		$('.seminar:visible').hide();
		$($(this).attr('href')).show();
		return false;
	});
	
//*
	//  Seminars within each tabbed section, changes are synchronised (old version below)
	
	var $seminars = $('#seminars .seminar');
	
	$('.semIndex a').click(function(){
	
		var index = $( this ).parent().index();
		
		$seminars.each( function( i, el ) {

			var $div   = $( el );

			$div.find( 'ul.semIndex li a' ).removeClass( 'on' ).eq( index ).addClass( 'on' );
			$div.find( 'div.semContent' ).children().hide();					//  Cannot use ":visible" as non-showing seminars won't be affected
			$div.find( 'div.semContent:eq(' + index + ')' ).children().show();

		});

		return false;
	});
//*/	
	/*
	//
	//  OLD VERSION
	//
	
	$('.semIndex a').click(function(){
		$('.seminar:visible .semIndex a.on').removeClass('on');
		$(this).addClass('on');
		$('.semContent:visible > a').hide();
		$('.semContent:visible .semList:visible').hide();
		$('a[name=' + $(this).attr('href').replace('#', '') + ']').show().next('.semList').show();
		return false;
	});
	//*/
});
$(function() {
    $('.slideshow').cycle();
});

$.fn.cycle.defaults = { 
    timeout:       6000,  // milliseconds between slide transitions (0 to disable auto advance) 
    speed:         1000,  // speed of the transition (any valid fx speed value) 
    next:          null,  // id of element to use as click trigger for next slide 
    prev:          null,  // id of element to use as click trigger for previous slide 
    before:        null,  // transition callback (scope set to element to be shown) 
    after:         null,  // transition callback (scope set to element that was shown) 
    height:       'auto', // container height 
    sync:          1,     // true if in/out transitions should occur simultaneously 
    fit:           0,     // force slides to fit container 
    pause:         0,     // true to enable "pause on hover" 
    delay:         0,     // additional delay (in ms) for first transition (hint: can be negative) 
    slideExpr:     null   // expression for selecting slides (if something other than all children is required) 
}; 

