/*----------------------------------------
DAFP Javascript
Author: Marcus Ellis
Last Updated: October 31, 2011
(c) 2011 Affiniscape, Inc.
All Rights Reserved. This JavaScript file must not be reproduced without the express written permission of Affiniscape, Inc.
For questions regarding licensing or setup please contact Affiniscape, projects @ affiniscape dot com
----------------------------------------*/

var j = jQuery.noConflict();
j(document).ready(function($){

	// Events
	$('#events-widget').new360events({
		url: 'http://m360.dallasafp.org/calendar.aspx',
		items: 3,
		style: 'compact'
	});
    
	// Mktg Banner
	$('#banner ul').incMarketingBanner({
		showButtons: true
	});
	
	// RSS Feed
	$('#rss-widget').incFeedWidget({
		url: 'http://pipes.yahoo.com/pipes/pipe.run?_id=ef2a98bf6f2b861bca4fe4dc34448c07&_render=rss',
		count: 4
	});
	
	// Jobs
	var delay = 2500;
	function scrollJobs(d){
		var ht = $('#jobs ol').height();
		var pos = $('#jobs ol').position();
		if (ht > $('#jobs .inner').height()) {
			var dist = Math.round(ht + pos.top);
			var time = Math.round(dist * 75);
			$('#jobs ol').delay(d).animate({
				top: '-'+ ht +'px'
			}, time, 'linear', function(){
				$(this).hide().css('top','5px').fadeIn();
				scrollJobs(delay);
			});
		}
	}
	$('#jobs ol').hover(
		function(){ $(this).stop(true);	},
		function(){ scrollJobs(0); }
	);
	scrollJobs(delay);
	
	// Login
	$('#login-widget').incLoginWidget({
		forgotPassText: 'Forgot password?',
		showForgotUser: false,
		showAutoLogout: false,
		buttonImage: '/associations/12882/imgs/btn-login.png',
		hoverImage: '/associations/12882/imgs/btn-login-hover.png'
	});
	
	// Sponsors
	$('#rightnavcell ul,#sponsors ul').incSponsorBox();
	
	// Clickable Logo
    $('body').addClickableLogo({
        name: 'Dallas Association for Financial Professionals',
        url: 'http://www.dallasafp.org'
    });
    
	// Search
	$('#assnbanner2cell').append('<div id="search-widget"></div>');
	$('#search-widget').incSearchWidget({
		buttonImage: '/associations/12882/imgs/btn-search.png',
		hoverImage: '/associations/12882/imgs/btn-search-hover.png'
	});
	
});

