$(document).ready( function() {
	$('div#wod-wrapper').height($('div#wod-1').height());
	
	$('#wod-prev').click(function() {
		if(!$(this).hasClass('off')) {
			var activeID = $('div#wod-wrapper div.active').attr('id');
			var prevID;
			if(activeID.substr(4)==5) { prevID = 0; }
			else { prevID = parseInt(activeID.substr(4)) + 1; }
			$('div#wod-wrapper div.active').removeClass('active');
			$('div#wod-wrapper').height($('div#wod-wrapper div#wod-' + prevID).height());
			$('div#wod-wrapper div#wod-' + prevID).addClass('active');
			if(prevID == 5) { $(this).addClass('off'); }
			if(prevID > 1 ) { $('#wod-next').removeClass('off'); }
		}
	});
	
	$('#wod-next').click(function() {
		if(!$(this).hasClass('off')) {
			var activeID = $('div#wod-wrapper div.active').attr('id');
			var nextID;
			if(activeID.substr(4)==1) { nextID = 0; }
			else { nextID = parseInt(activeID.substr(4)) - 1; }
			$('div#wod-wrapper div.active').removeClass('active');
			$('div#wod-wrapper').height($('div#wod-wrapper div#wod-' + nextID).height());
			$('div#wod-wrapper div#wod-' + nextID).addClass('active');
			if(nextID == 1) { $(this).addClass('off'); }
			if(nextID < 5 ) { $('#wod-prev').removeClass('off'); }
		}
	});
	
	$('div#' + $('h2 a[title="Do You Like Social Websites?"]').parent().parent().attr('id') + ' a').each(function() {
		$(this).attr('target', '_blank');
		$(this).attr('onclick', 'window.open("https://www.facebook.com/groups/127925373233/","newwin");');
	});

	$('div#wppb_login form p a').text('Lost your password?');
	$('div#wppb_login form p a').attr('href','/recover-password');
	$('div#wppb_login form p a').parent().prepend('<a href="/register" >Register</a> | ');
	
	$('div#wppb_register p').each(function() {
		if($(this).attr('class').indexOf('form-textarea') > -1) {
			$(this).addClass('reg-hide');
		}
		if($(this).attr('class').indexOf('form-input') > -1) {
			$(this).addClass('reg-hide');
		}
		if($(this).attr('class').indexOf('form-upload') > -1) {
			$(this).addClass('reg-hide');
		}
	});
	
	$('div_login font').attr('style','color: #F5F5F5; font-size: 16px; line-height: 20px; width: 315px; margin: 0 auto; ');
}); 
