/**
 * Define firebug's console object as a plug
 */
if (typeof console == typeof some_undefined_variable) {
	var console = new (function() {
		this.info = this.log = function(msg) {
			//alert(msg);
		}
	});
}
/**
 * Global AJAX setup
 */
$.ajaxSetup({
	type: "POST",
	dataType: 'json',

	beforeSend: function (XMLHttpRequest) {
	  //this; // the options for this ajax request
	  console.info('ajax has started');
	},

	error: function (XMLHttpRequest, textStatus, errorThrown) {

	  // typically only one of textStatus or errorThrown
	  // will have info
	  //this; // the options for this ajax request
	  console.info('ajax error: ' + textStatus);
	},

	complete: function (XMLHttpRequest, textStatus) {
	  //this; // the options for this ajax request
	  console.info('ajax has finished, status: ' + textStatus);
	}

});



/**
 * Message System
 * Shows dynamic messages on top
 */
var msgSystem = new (function() {
	this.config = {
		id : 'message-system',
		hideIn : 4, // sec
		opacity : .95,
		imageLoading: '/css/images/loading.gif'

	};

	this.object = false;
	this.loading = false;
	this.visible = false;

	// Start system
	this.start = function(){
		if(!$('#'+this.config.id).length){
			// build html, if doesn't exist
			html = '<div id="' + this.config.id + '"></div>';
			$('body').append(html);
		}

		this.object = $('#' + this.config.id)
			.css('opacity', this.config.opacity)
			.hide();
	}

	// Set a simple message
	this.message = function(text) {
		if ( ! this.object) {
			return false;
		}

		this.object.empty().append(text);
		this.show();
		this.loading = false;
	}

	// Show
	this.show = function() {
		this.object.stop();
		//if ( ! this.visible) {
			this.visible = true;
			this.object.fadeIn('fast', function() {
				msgSystem.hide(true);
			});

		//}
	}

	// Wait and Hide
	this.hide = function(wait) {
		if (wait) {
			this.object.animate({'opacity' : this.config.opacity}, this.config.hideIn * 1000, false, function() {
				msgSystem.object.fadeOut('fast', function() {
					msgSystem.visible = false;
				});
			});
		} else {
			this.object.fadeOut('fast', function() {
				msgSystem.visible = false;
			});
		}
	}

	// Start a loading message
	this.startLoading = function(text) {
		this.loading = true;

		text = text || '';

		this.object.empty()
			.append('<img src="' + this.config.imageLoading + '" alt="!" /> ')
			.append(text)
			.fadeIn('fast');
	}

	// Finish a loading message
	this.finishLoading = function() {
		if (this.loading) {
			this.hide();
		}
	}

});
/**
 * Dialog (as a modal plugin wrapper)
 * Shows a modal dialog, maybe with some buttons
 */
var dialog = function($el, options, buttons) {
	// set settings
	var config = {
		closeTitle : 'Close',
		overlayCss : {},
		containerCss : {
			width : '500px',
			height : '300px',
			position : 'fixed',
			top : '30%',
			left : ($(document.body).width() - 400) / 2 + 'px'
		}
	};

//	if (options.overlay == false) {
//		config.overlayCss.zIndex = -1;
//	}
	if (options.close == false) {
		config.close = false;
	}

	if (options.size) {
		config.containerCss.width = options.size.width;
		config.containerCss.width += typeof config.containerCss.width == typeof 1 ? 'px' : '';
		config.containerCss.height = options.size.height;
		config.containerCss.height += typeof config.containerCss.height == typeof 1 ? 'px' : '';
	}
	if (options.position) {
		if (typeof options.position == typeof window) {
			config.containerCss.position = 'absolute';
			config.containerCss.left = options.position.left + 'px';
			config.containerCss.top = options.position.top + 'px';
		} else {
			switch (options.position) {
				case 'left':
					config.containerCss.left = 0;
					break;

				case 'right':
					config.containerCss.left = 'auto';
					config.containerCss.right = 0;
					break;

				case 'center':
				default:
					config.containerCss.left = ($(document.body).width() - parseInt(config.containerCss.width)) / 2 + 'px';
					break;
			}

			if ($.browser.msie && parseInt($.browser.version) < 7) {
				// fix top for static position in ie
				config.containerCss.top = $(document).scrollTop() + 100 + 'px';
			}
		}
	}

	if (options.moreCss) {
		config.containerCss = $.extend(config.containerCss, options.moreCss);
	}

	if ($.isFunction(options.onShow)) {
		config.onShow = options.onShow;
	}

	// add sexy animation
	config.onOpen = function($m) {
		$m.overlay.fadeIn('fast', function() {
			$m.container.slideDown('fast', function() {
				$m.data.show();
				if ($.isFunction(options.onOpen)) {
					options.onOpen();
				}
			});
		});
	};
	config.onClose = function($m) {
		$m.container.slideUp('fast', function() {
			$m.overlay.fadeOut('fast', function() {
				if ($.isFunction(options.onClose)) {
					options.onClose();
				}
				$.modal.close(true);
			});
		});
	};

	// add buttons if 'em exist
	if (typeof buttons == typeof window) {
		var holder = $('<div class="dialog-buttons"/>');

		// create buttons
		$.each(buttons, function(text, func) {
			$('<button type="submit" class="button" name="' + text + '"><span>'+text+'</span></button>').click(func).appendTo(holder);
		});

		// append 'em all
		$el = $('<div/>').append($el).append(holder);
	}

	return $.modal($el, config);
}
/**
 * Parse data like form's POST data
 * And bonus: Adds form's id as back-end requires
 */
var dataLikeForm = function(formId, data) {
	var result = 'form_id_passed=' + formId;
	if (data) {
		$.each(data, function(k, v) {
			result += '&' + k + '=' + v;
		});
	}

	return result;
}

/*
 * Changes form action in email-alerts block
 */
function changeSearchAction(){
	var cur_category = $("select#main-search-category").val();
	switch(cur_category){
		case 'projects':
			$("#main-search-form").attr({'action':'/project/all'});
			break;
		case 'network':
			$("#main-search-form").attr({'action':'/user/all'});
			$('#search').attr({'name':'name'});
			break;
	}
	return false;

}

$(document).ready(function(){

$("#nav-tree").treeview({
	collapsed: true
});
restore_menu_state();

//if user expands or collaps something update his data in db
$('div.hitarea').click(function(){
    var menu_state = '';
    $.each($('ul#nav-tree').children(),function(){
        if($(this).hasClass('collapsable')){
            var temp_class = $(this).attr('class').split(' ');
            menu_state += temp_class[0]+'&';
        }
    });
    var url = '/user/save_menu_state';
    $.post(url, {'menu_state':menu_state});
});

//on page load, restore user's menu select from db
function restore_menu_state(){
    $.post("/user/get_menu_state/", false, function(result){
    	if(result.data) {
    	    $.each(result.data, function(i, data){
    	        if(data.length > 0){
    	            $('ul#nav-tree li.'+data).removeClass('expandable').addClass('collapsable');
    	            //showing ul
    	            $('ul#nav-tree li.'+data+' ul').show();
    	            //and changing 'plus' icon
    	            $('ul#nav-tree li.'+data+' div').removeClass('expandable-hitarea').addClass('collapsable-hitarea');
    	        }
    	    });
    	};
    });
}


$('#contacts-submit').click(function() {

	var str = 'company_name=' + $('#company_name').val() +
	'&first_name=' + $('#first_name').val() +
	'&last_name=' + $('#last_name').val() +
	'&role=' + $('#role').val() +
	'&phone=' + $('#phone').val() +
	'&fax=' + $('#fax').val() +
	'&email=' + $('#email').val() +
	'&submit=submit&form_id_passed=user_create_contact';

	$.post('/user/add_contact', str, function(data){
		if (data.status == 200) {

				if (data.messages[0].level == 'success') {
		   			$('#formfield_contacts h4').after('<label for="contacts-' + data.data + '">' + $('#first_name').val() + ' '  + $('#last_name').val() + '</label>');
					$('#formfield_contacts h4').after('<input type="checkbox" value="' + data.data + '" name="contacts[]" id="contacts-' + data.data + '" checked="checked"/>');
					$('#contacts_fset em').empty();
					$('#company_name').val('');
					$('#first_name').val('');
					$('#last_name').val('');
					$('#role').val('');
					$('#phone').val('');
					$('#fax').val('');
					$('#email').val('');
				} else {
					$('#contacts_fset em').empty();
					 $.each(data.data, function(field, value){
						 $('#formfield_' + field + ' span').after('<em style="background: #faa">' +  value + '</em>');
					 });
				}
	    	}
		});

	return false;
});

});
String.prototype.isdigits=function(){
	return (/\D/.test(this)==false);
}

var votesJob = function() {
	$('a.vote-job').click(function(e) {
	e.preventDefault();

	// Only logged in users can do this job
	if (this.clicked) {
	return false;
	}

	this.clicked = true;

	$.ajax({
	anchor: this,
	//type: "get",
	data: 'foo=bar',
	url: this.href,
	success: function(answer) {
		if (answer.messages.length) {
			msgSystem.message(answer.messages[0].text);

			if (answer.messages[0].level == 'success') {
				// toggle class for icon

				var a = $(this.anchor).toggleClass('active');
				var rating =  a.parent().parent().find(".rating");
				var t = answer.data.vote.result;
				//shows, if this user is already voted for
				var voted = answer.data.vote.voted;

				li_voted = a.parent();

				if(a.hasClass('minus')){
					li_voted.removeClass('voted_plus');
					li_voted.addClass('voted_minus');
				}else{
					li_voted.removeClass('voted_minus');
					li_voted.addClass('voted_plus');
				}

				var rat = 0;
				rating.removeClass('low');
				rating.removeClass('high');
				rating.removeClass('null');

				if (t<0){
					if(parseInt(rating.text()) + t <0){
						rating.addClass('low');
					}else if(parseInt(rating.text()) + t>0){
						rating.addClass('high');
					}else{
						rating.addClass('null');
					}
					rat = parseInt(rating.text()) + t;
				}else if(t>0){
					if(parseInt(rating.text()) + t <0){
						rating.addClass('low');
					}else if(parseInt(rating.text()) + t>0){
						rating.addClass('high');
					}else{
						rating.addClass('null');
					}
					rat = parseInt(rating.text()) + t;
				}

				rating.text(rat);

			}
		}



		this.anchor.clicked = false;
	}
	});

	});
};

var edit_ajax = function (data, url){
	$.post(url, data, function(answer){
		if (answer.messages.length) {
			msgSystem.message(answer.messages[0].text);
		}
	});
}

function ucfirst (str) {
    // Makes a string's first character uppercase
    //
    // version: 909.322
    // discuss at: http://phpjs.org/functions/ucfirst
    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   bugfixed by: Onno Marsman
    // +   improved by: Brett Zamir (http://brett-zamir.me)
    // *     example 1: ucfirst('kevin van zonneveld');
    // *     returns 1: 'Kevin van zonneveld'
    str += '';
    var f = str.charAt(0).toUpperCase();
    return f + str.substr(1);
}

/**
 * Tooltips setup
 */
var toolTips = function($el) {
	var config = {
		delay: 333,
		showBody: ': ',
    	showURL: false
	};

	if ( ! $el) {
		// default anchors tooltips
		$('a, tr').tooltip(config);
	} else {
		$el.tooltip(config);
	}
}


/**
 * Notes Job
 * Edits and saves user's notes via AJAX
 */
var admin_functions = function() {

	$('.admin_function').each(function() {
		$('.send_comment', this).each(function() {
			var button = $(this),
				d = false,
				send_data = {
					'submit-create_log' : "t",
					page :  window.location.href
				};

			var oform,
				element,
				title;


			if (button[0].tagName.toLowerCase() == 'a') {
				send_data.action = button[0].href;
				element = 'a';
			} else if (button[0].tagName.toLowerCase() == 'button'){
				oform = button[0].form;
				send_data.action =  oform.action;
				element = 'button';
			}
			if (send_data.action == ''){
				send_data.action = send_data.page;
			}

			if ( send_data.action.match('/project/')){
				send_data.type = 'project';
				type_title = 'Project';
			} else if (send_data.action.match('/bid/')) {
				send_data.type = 'bid';
				type_title = 'Bid';
			} else if (send_data.action.match('/classified/')) {
				send_data.type = 'classified';
				type_title = 'Classified';
			} else if (send_data.action.match('/question/')) {
				send_data.type = 'question';
				type_title = 'Question';
			} else if (send_data.action.match('/answer/')) {
				send_data.type = 'answer';
				type_title = 'Answer';
			} else if (send_data.action.match('/post/')) {
				send_data.type = 'post';
				type_title = 'Photo';
			} else if (send_data.action.match('/comment/')) {
				send_data.type = 'comment';
				type_title = 'Comment';
			} else if (send_data.action.match('/user/')) {
				send_data.type = 'user';
				type_title = 'User';

			}


			if (send_data.action.match('/delete/')){
				send_data.mode = 'delete';
				title = 'Please enter moderation comment.';

			} else if (send_data.action.match('/edit/')){
				send_data.mode = 'edit';
				title = 'Please enter moderation comment.';

			} else if (send_data.action.match('/change_plan/')){
				send_data.mode = 'change_plan';
				title = 'Please enter moderation comment.';

			} else if (send_data.action.match('/report/')){
				send_data.mode = 'report';
				title = 'Flag '+ type_title +' as inappropriate. Your message would be delivered to Bidjobber administrator.<br/> Please describe the reason for flagging this '+ type_title + ' in as much detail as you can.';

			} else if (send_data.action.match('/activate/')){
				send_data.mode = 'activate';
				title = 'Please enter moderation comment.';

			}



			var form = $('<div class="admin-window popup-form">'
					+ '<h4>' + title + '</h4>'
					+ '<textarea id="tcomment"></textarea>'
					+ '</div>'
				);



			// define job function
			var send = function() {

				var buttons = new Object;

				if (send_data.mode == "delete") {
					buttons.Delete = save;
				} else if (send_data.mode == "edit") {
					buttons.Edit = save;
				} else if (send_data.mode == "change_plan") {
					buttons.Change = save;
				} else if (send_data.mode == "activate") {
					buttons.Activate = save;
				} else {
					buttons.Send = save;
				}

				buttons.Cancel = cancel;
				d = dialog(form, {
	//				position : absoluteOffsets(button, true),
					size : { width : 'auto', height : 'auto' },
					//overlay : false,
					onShow : function($m) {
						var t = $('textarea', $m.data);
						t[0].select();
						//t[0].focus();

					}
				}, buttons);
			}

			// define save function
			var save = function() {
				if (this.clicked) {
					return false;
				}

				this.clicked = true;

				var newText = $('textarea', d.dialog.data).val();

				if (newText.length <=0 ) {
					cancel();
					this.clicked = false;
					return false;
				}

				send_data.comment = newText;
				if (send_data.mode == 'change_plan'){
					$("input[name='package']").each(function () {
						if ($(this).attr('checked') == true){
							send_data.mpackage =  $(this).val();
						}
					});
				}


				$.ajax({
					anchor: this,
					url: "/admin/create_log",
					data: dataLikeForm('create_log', send_data),
					success: function(answer) {
						if (answer.messages.length) {
							msgSystem.message(answer.messages[0].text);
						}
						//sucsess
						if (answer.messages[0].level != 'error') {
							// hide the form
							if (element == 'a' && send_data.mode != 'report') {
								window.location.href = send_data.action;
							} else if (element == 'button'){
								oform.submit();
							}
						}
					}
				});

				cancel();
			}

			// define cancel function
			var cancel = function() {
				d.close();
				d = false;
			}

			// attach events
			button.click(function(e) {
				e.preventDefault();
				send();

			});
		});
	});
}



var award = function() {

	$('.award').each(function() {
		var button = $(this),
				d = false;

			// define job function
			var send = function(form) {

				var buttons = new Object;
				buttons.Award = save;


				buttons.Cancel = cancel;
				d = dialog(form, {
	//				position : absoluteOffsets(button, true),
					size : { width : 'auto', height : 'auto' },
					//overlay : false,
					onShow : function($m) {
						//t[0].focus();

					}
				}, buttons);
			}

			// define save function
			var save = function() {
				if (this.clicked) {
					return false;
				}

				this.clicked = true;


				var str = $("#form-award_form").serialize()

				$.ajax({
					anchor: this,
					url:  $('#form-award_form').attr('action'),
					data: str,
					success: function(answer) {
						if (answer.messages.length) {
							msgSystem.message(answer.messages[0].text);
						}
						//sucsess
						if (answer.messages[0].level != 'error') {
							// hide the form
							window.location.href = window.location.href;
						}
					}
				});

				cancel();
			}

			// define cancel function
			var cancel = function() {
				d.close();
				d = false;
			}

			// attach events
			button.click(function(e) {
				e.preventDefault();

				$.ajax({
					anchor: this,
					url: button[0].href,
					data: '',
					success: function(answer) {

						if (answer.html.length) {
							var window = $('<div class="admin-window popup-form">'
									+ answer.html
									+ '</div>'
								);

							send(window);

						}
					}
				});

			});

	});
}


var block_member = function() {
	var d = false;
	var send = function(mode) {
		if(mode) {
			window.location.href = $('#block_member')[0].href;
		}
		d.close();
		d = false;
		

	}
	$('#block_member').click(function(e){
		this.clicked = false;
		e.preventDefault();
		d = dialog('<div class="admin-window popup-form">'
				+'<h1>Blocked Members</h1>'
				+'<p> Blocked members are not be able to:'
				+'	<ul>'
				+'	<li>View your profile;</li>'
				+'	<li>Send a message to you;</li>'
				+'	<li>Connect to you;</li>'
				+'	<li>View details of your projects;</li>'
				+'	<li>Submit bids on your projects;</li>'
				+'	<li>View details of your classifieds;</li>'
				+'	<li>Submit a testimonial on you;</li>'
				+'	<li>Comment on your photos;</li>'
				+'	<li>Submit answers to your questions;</li>'
				+'	<li>Invite you to bid on their projects;</li>'
				+'	<li>Submit material quotes on your quote requests.</li>'
				+'	</ul>'
				+'	</p>'
				+ '</div><br />', {
			size : { width : '400px', height : 'auto' }
		}, {
			'Block this member' : function() {
				send(true);
			},
			'Cancel' : function() {
				send(false);
			}
		});



	});
}



/**
 * Favorites Job
 * Adds or deletes user's favorite objects via AJAX
 */
var favoritesJob = function() {
	$('a.favorite-job').click(function(e) {
		e.preventDefault();

		// Only logged in users can do this job
		if (userId) {
			if (this.clicked) {
				return false;
			}

			this.clicked = true;

			$.ajax({
				anchor: this,
				//type: "get",
				data: 'foo=bar',
				url: this.href,
				success: function(answer) {
					if (answer.messages.length) {
						msgSystem.message(answer.messages[0].text);

						if (answer.messages[0].level == 'success') {
							// toggle class for icon
							var a = $(this.anchor).toggleClass('active-favorite-job');

							// convert href and tooltip text
							if (this.anchor.href.match('/add/')) {
								a.attr('href', this.anchor.href.replace('/add/', '/delete/'));
								this.anchor.tooltipText = 'Remove from favorites';
								a.text('Remove from favorites');
//								console.info(this.anchor.tooltipText, 1);
							} else {
								a.attr('href', this.anchor.href.replace('/delete/', '/add/'));
								this.anchor.tooltipText = 'Add to favorites';
								a.text('Add to favorites');
//								console.info(this.anchor.tooltipText, 0);
							}
						}
					}



					this.anchor.clicked = false;
				}
			});
		} else {
			msgSystem.message('Only logged in users can do this job');
		}
	});
}



var manageTaskRecurring = function(){
	// Event handling & right dates checking
	$("#from_dates, #to_dates").change(function(){
		var $from = $("#from_dates").val();
		var $to = $("#to_dates").val();
		if($from != $to){
			// check dates to to be equal, otherwise - just disable recurring select
			// mark disabled
			markTaskRecurring();
		}else{
			//mark enabled
			markTaskRecurring(true);
		}
	});
}
/*=====Helper Calendar Functions====*/
/**
* Enable/Disable Personal Task Recurring Field
**/
function markTaskRecurring(enable){
	if(enable){
		$("#recurring").removeAttr('disabled');
	}else{
		$("#recurring").attr('disabled','disabled');
		$('select#recurring option:first').attr('selected', 'yes');
		$("#formfield_recurring_to_date, #formfield_recurring_to").hide();
	}
}
/**
* Check Task Recurring Field after calendar date selecting
**/
var checkTaskRecurring = function(){
	if($("#dates-from-month").val() != $("#dates-to-month").val() ||
		$("#dates-from-day").val() != $("#dates-to-day").val()	||
		$("#dates-from-year").val() != $("#dates-to-year").val()){
			markTaskRecurring();
	}else{
		markTaskRecurring(true);
	}
}
/*=====End of Helper Calendar Functions====*/


/**
* Create new event on calendar date click
*/
function calendar_event(dateIn) {
	evDate = dateIn.data.Date;
	evMonth = evDate.getMonth()+1;
	eventDate = evMonth+'/'+evDate.getDate()+'/'+evDate.getFullYear();

	// define save function
	var save = function() {
		var str = $("form.popup_event_form").serialize();
		//var ev_type = $('form.popup_event_form input:radio:checked').val();

		str+='&due_date='+eventDate;
		// Send form data
		$.post($(form).attr('action'), str,function(answer) {

					if(typeof asnwersmessages != undefined && answer.messages.length){
						var message = '';
						$.each(answer.messages,function(i,msg){
							message += msg.text+'<br/>';
						});
						// Show all messages
						msgSystem.message(message);
					}

					//var newData = typeof answer.event != 'undefined' ? answer.event : '';
					/*if(typeof newData != 'undefined'){
						// Add newly created event to user's calendar
						var addEvent = new Object;
						addEvent = {"EventID":i,'StartDateTime':new Date(eventDate),"EndDateTime":new Date(eventDate),"Title":,'URL':'', "Description": , "CssClass":task.type+' status_'+task.status};
						$.jMonthCalendar.addEvents(addEvent);
					*/

				}
		);
		cancel();
	}

	// define cancel function
	var cancel = function() {
		d.close();
	}

	var form = $("#form-new_event_form").clone().show().addClass('popup_event_form');


	// Show modal window
	var buttons = new Object;
	buttons.Create = save;
	buttons.Cancel = cancel;
	d = dialog(form, {
		size : { width : 'auto', height : 'auto' },
		overlay : true
	}, buttons);

	// Change new form ids
	$.each($("form.popup_event_form div.radio").children(),function(i,el){
		if($(el).attr('for')){
			$(el).attr({'for':$(el).attr('for')+'_0'});
		}
		if($(el).attr('id')){
			$(el).attr({'id':$(el).attr('id')+'_0'});
		}
	});
	$.each($('form.popup_event_form div#formfield_contractors div.subset').children(),function(i,el){
		if($(el).attr('for')){
			$(el).attr({'for':$(el).attr('for')+'_0'});
		}
		if($(el).attr('id')){
			$(el).attr({'id':$(el).attr('id')+'_0'});
		}
	});

	var presDate = evMonth+'/'+evDate.getDate()+'/'+evDate.getFullYear();
	var date_link = '<div>Event on '+presDate+' (<a id="details" href="#">Change</a>)</div><br/>';
	$("form.popup_event_form #edit_details").prepend(date_link);

	// Some events handling
	$('#edit_details a, #details').click(function(e){
		e.preventDefault();
		$("form.popup_event_form #due_date").val(evMonth+'/'+evDate.getDate()+'/'+evDate.getFullYear());

		$(form).submit();
	});


	$('form.popup_event_form input[name="event_type"]').change(function(){
		$(form).attr('action','/'+$(this).val() + '/'+create_type+'/'+pid);
	});
}




/**
 * Let's load user's CPU on DOM ready
 */
$(function(){

	msgSystem.start();
	admin_functions();
	award();
	toolTips(); // make more visible tooltips
	block_member();
	if(currentMod.primary == 'blog_category' || currentMod.primary == 'post'){
		votesJob();
	} else if (currentMod.primary == 'user' && currentMod.secondary == 'company_contact'){
		$('.editable_contact').editable(function(value, settings) {
		 var id = $(this).attr("class").replace(/(.*)contact_([0-9]+)(.*)/gi, "$2");
		 var field = $(this).attr("class").replace(/(.*)field_(.*) (.*)/gi, "$2");
		 var data = 'form_id_passed=user_company_contact&' + field + '=' + value + '&submit=t';
		 //field + '=' + value + '&submit_edit_question=t'
	     edit_ajax(data, url('user/edit_contact/' + id));
		 return(value);
	  }, {
	     type    : 'textarea',
	     tooltip   : 'Click to edit contact',
	     submit  : 'OK'
	 });
	} else if(currentMod.primary == 'task' && (currentMod.secondary == 'create_personal' || currentMod.secondary == 'edit_personal')){
		manageTaskRecurring();
	} else if ((currentMod.primary == 'project' && (currentMod.secondary == 'all' || currentMod.secondary == 'view'|| currentMod.secondary == 'index' || currentMod.secondary == 'bids')) ||(currentMod.primary == 'classified' && (currentMod.secondary == 'all'|| currentMod.secondary == 'view'|| currentMod.secondary == 'index')) || currentMod.primary == 'favorites'){
		favoritesJob();
	}


	$("tbody > tr:nth-child(odd)").addClass("odd");

});