function checkField(field_id, alertMsg)
{
	var field = get(field_id);
	if(!field.value)
	{
		field.focus();
		alert(alertMsg);
		return false;
	}
	return true;
}

var browserWidth = null;
var browserHeight = null;

function calculateSize(fullSize)
{
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) 
	{
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	} 
	else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) 
	{
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
		
	} 
	else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) 
	{
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
		myWidth = myWidth + 25;
	}
	browserWidth = myWidth;
	browserHeight = myHeight;
	
	if(fullSize == 0)
		browserWidth = browserWidth + 200;
	
	var contentBox = get('contentBox');
	var tabRow = get('tabRow');
	contentBox.style.width = browserWidth - 260;
	if(tabRow)
		tabRow.style.width = browserWidth - 250;
}

function callOverlibBlue(text)
{
	return overlib("<span style='font-weight: bold; color: white; font-size: 12px;'>" + text + "</span>", BGCOLOR, "white", FGCOLOR, "#2f62a0", WIDTH, "250");
}

function callOverlibTrans(title, text, imgPath)
{
	text = text.replace("'", "");
	return overlib('<div style="width: 254px; padding: 6px; font-size: 11px; font-family: Verdana, Helvetica, sans-serif; color: #696969; * width: 265px; * height: 106px; border: 1px solid #366fb4;"><strong>' + title + '</strong><br /><div style="padding: 10px;">' + text + '</div></div>', BGCOLOR, '', FGBACKGROUND, imgPath + '/tooltipTrans.png', FGCOLOR, '', OFFSETX, 5, OFFSETY, 5);
}

function getCurrentDate()
{
	// Get today's current date.
	var now = new Date();
	
	// Array list of days.
	var days = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
	
	// Array list of months.
	var months = new Array('January','February','March','April','May','June','July','August','September','October','November','December');
	
	// Calculate the number of the current day in the week.
	var date = ((now.getDate()<10) ? "0" : "")+ now.getDate();
	
	// Calculate four digit year.
	function fourdigits(number)	{
		return (number < 1000) ? number + 1900 : number;
									}
	
	// Join it all together
	today =  days[now.getDay()] + ", " +
	              months[now.getMonth()] + " " +
	               date + ", " +
	                (fourdigits(now.getYear())) ;
	
	// Print out the data.
	document.write("" +today+ ".");
}

function get(id)
{
	return document.getElementById(id);
}

function getValue(id)
{
	return document.getElementById(id).value;
}

function goTo(url)
{
	document.location = url;
}

function FormatNumberBy3(num, decpoint, sep) 
{
	// check for missing parameters and use defaults if so
	if (arguments.length == 2) 
		sep = ",";
	if (arguments.length == 1) 
	{
		sep = ",";
		decpoint = ".";
	}
	// need a string for operations
	num = num.toString();
	// separate the whole number and the fraction if possible
	a = num.split(decpoint);
	x = a[0]; // decimal
	y = a[1]; // fraction
	z = "";
	
	
	if (typeof(x) != "undefined") 
	{
		// reverse the digits. regexp works from left to right.
		for (i=x.length-1;i>=0;i--)
		  z += x.charAt(i);
		// add seperators. but undo the trailing one, if there
		z = z.replace(/(\d{3})/g, "$1" + sep);
		if (z.slice(-sep.length) == sep)
		  z = z.slice(0, -sep.length);
		x = "";
		// reverse again to get back the number
		for (i=z.length-1;i>=0;i--)
		  x += z.charAt(i);
		// add the fraction back in, if it was there
		if (typeof(y) != "undefined" && y.length > 0)
		  x += decpoint + y;
		else
		  x += decpoint + '00';
	}
	return x;
}


var lastDisplayedRBanner;
var rbannerRotationRunning = 0;
function displayRBanner(banner_id)
{
	if(lastDisplayedRBanner)
		document.getElementById('rbanner_' + lastDisplayedRBanner).style.display = 'none';
		
	lastDisplayedRBanner = banner_id;
	document.getElementById('rbanner_' + banner_id).style.display = 'block';
}

function controlRBannerRotation()
{
	if(rbannerRotationRunning)
		stopRBannerRotation();
	else
		runRBannerRotation();
}

function runRBannerRotation()
{
	rbannerRotationTimeout = setTimeout('switchRBanner()', rbannerRotationInterval * 1000);
	rbannerRotationRunning = 1;
}

function switchRBanner()
{
	var next = parseInt(lastDisplayedRBanner) + 1;
	if(!document.getElementById('rbanner_' + next))
		next = 1;
	displayRBanner(next);
	rbannerRotationTimeout = setTimeout('switchRBanner()', rbannerRotationInterval * 1000);
}

function stopRBannerRotation()
{
	clearTimeout(rbannerRotationTimeout);
	rbannerRotationRunning = 0;
}

function selectCurrentCategory()
{
	var field_category_select = get('selectedCategory');
	if(field_category_select.value)
		goTo('?action=marketingAdmin_showTemplates&category_id=' + field_category_select.value);
}

function selectReport(user_id)
{
	var field_report_select = get('report_data_id');
	if(field_report_select.value)
		goTo('?action=reports_viewReport&user_id=' + user_id + '&report_id=' + field_report_select.value);
}

function selectReportsUser()
{
	var left_user_id = get('left_user_id');
	var right_user_id = get('right_user_id');
	goTo('?action=reports_compareReports&left_user_id=' + left_user_id.value + '&right_user_id=' + right_user_id.value);
}

function selectDRAOperatingSystemServer()
{
	var field_os = get('operating_system');
	var zone_os_other = get('otherOperatingSystemField');
	if(field_os.value == 'Other')
		zone_os_other.style.display = 'block';
	else
		zone_os_other.style.display = 'none';
}

function showAjaxLoader()
{
	var loader = get('ajaxLoader');
	loader.style.display = 'block';
}

function switchReportsPeriod(user_id, target)
{
	var month = get('filter_month');
	var year = get('filter_year');
	goTo('?action=' + target + '&user_id=' + user_id + '&month=' + month.value + '&year=' + year.value);
}

function switchReportCompare()
{
	var left_report_id = getValue('left_report_id');
	var right_report_id = getValue('right_report_id');
	var field_user_id = get('user_id');
	if(!field_user_id)
	{
		var left_user_id = getValue('left_user_id');
		var right_user_id = getValue('right_user_id');
		goTo('?action=reports_compareReports&left_user_id=' + left_user_id + '&right_user_id=' + right_user_id + '&left_report_id=' + left_report_id + '&right_report_id=' + right_report_id);
	}
	else
	{
		goTo('?action=reports_compareReports&left_report_id=' + left_report_id + '&right_report_id=' + right_report_id);
	}
}

function switchReportsFirmSummary()
{
	var month = get('month');
	var year = get('year');
	goTo('?action=reports_firmSummaryReport&month=' + month.value + '&year=' + year.value);
}

function switchAdvisorBreakdownPeriod()
{
	var period = get('advisor_breakdown_period');
	var subsection = get('subsection');
	goTo('?action=reportsAdmin_showAdvisorBreakdown&display=' + period.value + '&subsection=' + subsection.value);
}

function showHideReportsYear(year)
{
	var yearZone = get('year_zone_' + year);
	//var switchButton = get('switch_button_' + year);
	if(yearZone.style.display == 'block')
	{
		yearZone.style.display = 'none';
		//switchButton.innerHTML = 'Show';
	}
	else if(yearZone.style.display == 'none')
	{
		yearZone.style.display = 'block';
		//switchButton.innerHTML = 'Hide';
	}
}

var assignedTo = null;
function FPTSWorkflowSelectDefaultAssigned(assignedId)
{
	assignedTo = assignedId;
	var assigned = ['8', '66', '10', '26', '251', '246', '253', '67', '275', '11', '210', '201'];
	assigned.forEach(FPTSWorkflowCheckAssigned);
	assignedTo = null;
}

function FPTSWorkflowCheckAssigned(value, index)
{
	var checkbox = get('assign_to_' + value);
	if(parseInt(value) == parseInt(assignedTo))
		checkbox.checked = true;
	else
		checkbox.checked = false;
}

function FPTSWorkflowSelectOther()
{
	var radio = get('radio_task_category_other');
	radio.checked = true;
}

function validateFormRegister()
{
	var form = get('formRegister');
	
	if(!checkField('register_fname', 'Please enter your first name.')) return false;
	if(!checkField('register_lname', 'Please enter your last name.')) return false;
	if(!checkField('register_firm_name', 'Please enter the name of your firm.')) return false;
	if(!checkField('register_email', 'Please enter your e-mail.')) return false;
	if(!checkField('register_address', 'Please enter your address.')) return false;
	if(!checkField('register_city', 'Please enter your city.')) return false;
	if(!checkField('register_state', 'Please enter your state.')) return false;
	if(!checkField('register_zip', 'Please enter your zip code.')) return false;
	if(!checkField('register_phone', 'Please enter your phone.')) return false;
	if(!checkField('register_fax', 'Please enter your fax.')) return false;
	if(!checkField('register_birth_day', 'Please enter your complete date of birth.')) return false;
	if(!checkField('register_birth_month', 'Please enter your complete date of birth.')) return false;
	if(!checkField('register_birth_year', 'Please enter your complete date of birth.')) return false;
	if(!checkField('register_password', 'Please enter your password.')) return false;
	if(!checkField('register_password_again', 'Please re-enter your password again.')) return false;
	if(!checkField('register_verify_code', 'Please type in the numbers in the verification box.')) return false;
	
	form.submit();
}

function validateFormForgot()
{
	var form = get('formForgot');
	
	if(!checkField('forgot_email', 'Please enter your e-mail address')) return false;
	if(!checkField('forgot_verify_code', 'Please type in the numbers in the verification box.')) return false;
	
	form.submit();
}

function validateFormLogin()
{
	var form = get('formLogin');
	
	if(!checkField('login_username', 'Please enter your username.')) return false;
	if(!checkField('login_password', 'Please enter your password.')) return false;
	
	form.submit();
}

function validateFormUpdateMyProfile(user_id)
{
	var valid = 1;
	var form = get('formUpdateProfile');
	var requestResult = get('requestResult_updateSettings');
	requestResult.innerHTML = '';
	
	if(!checkField('FName', 'Please fill in your first name.')) valid = 0;
	if(!checkField('LName', 'Please fill in your last name.')) valid = 0;
	if(!checkField('email', 'Please fill in your e-mail.')) valid = 0;
	if(!checkField('address', 'Please fill in your address.')) valid = 0;
	if(!checkField('city', 'Please fill in your city.')) valid = 0;
	if(!checkField('state', 'Please fill in your state.')) valid = 0;
	if(!checkField('zip', 'Please fill in your zip code.')) valid = 0;
	if(!checkField('firm_name', 'Please fill in your firm name.')) valid = 0;
	if(!checkField('phone', 'Please fill in your phone number.')) valid = 0;
	
	if(valid)
		requestUpdateSettings(user_id);
}

// VALIDATE MARKETING
function validateAddCategory()
{
	var form = get('formAddCategory');
	
	if(!checkField('category_name', 'Please enter a name for this category.')) return false;
	if(!checkField('weight', 'Please enter a weight (order) value for this category.')) return false;
	
	form.submit();
}

function validateEditCategory()
{
	var form = get('formEditCategory');
	
	if(!checkField('category_id', 'Internal error: missing category id.')) return false;
	if(!checkField('category_name', 'Please enter a name for this category.')) return false;
	if(!checkField('weight', 'Please enter a weight (order) value for this category.')) return false;
	
	form.submit();
}

function validateMarketingAddEditSubcategory()
{
    var form = get('formMarketingAddEditSubcategory');
    
    if(!checkField('subcategory_name', 'Please enter a name for this subcategory.')) return false;
    if(!checkField('category_id', 'Please choose a parent category.')) return false;
    if(!checkField('weight', 'Please enter a weight (order) value for this subcategory.')) return false;
    
    form.submit();
}

function validateAddTemplate()
{
	var form = get('formAddTemplate');
	
	if(!checkField('category_id', 'Internal error: missing category id.')) return false;
	if(!checkField('template_name', 'Please enter a name for this template.')) return false;
	if(!checkField('weight', 'Please enter a weight (order) value for this template.')) return false;

	form.submit();
}

function validateEditTemplate()
{
	var form = get('formEditTemplate');
	
	if(!checkField('category_id', 'Internal error: missing category ID.')) return false;
	if(!checkField('template_id', 'Internal error: missing template ID.')) return false;
	if(!checkField('template_name', 'Please enter a name for this template.')) return false;
	if(!checkField('weight', 'Please enter a weight (order) value for this template.')) return false;
	
	form.submit();
}

function validateCustomizeTemplate()
{
	var form = get('formCustomizeTemplate');
	
	if(!checkField('template_name', 'Please enter a name for this template.')) return false;
	if(!checkField('content', 'Please create a content for that template.')) return false;
	if(!checkField('weight', 'Please enter a weight (order) value for this template.')) return false;
	
	form.submit();
}

// VALIDATE SURVEY
function validateAddSurveyCategory()
{
	var form = get('formAddCategory');
	
	if(!checkField('category_name', 'Please enter a category name.')) return false;
	if(!checkField('weight', 'Please enter a weight (order) for this category.')) return false;
	
	form.submit();
}

function validateEditSurveyCategory()
{
	var form = get('formEditCategory');
	
	if(!checkField('category_id', 'Internal error: missing category ID.')) return false;
	if(!checkField('category_name', 'Please enter a category name.')) return false;
	if(!checkField('weight', 'Please enter a weight (order) for this category.')) return false;
	
	form.submit();
}

function validateAddQuestionCategory()
{
	var form = get('formAddQuestionCategory');
	
	if(!checkField('category_name', 'Please enter a category name.')) return false;
	if(!checkField('weight', 'Please enter a weight (order) for this category.')) return false;
	
	form.submit();
}

function validateEditQuestionCategory()
{
	var form = get('formEditQuestionCategory');
	
	if(!checkField('category_name', 'Please enter a category name.')) return false;
	if(!checkField('weight', 'Please enter a weight (order) for this category.')) return false;

	form.submit();
}

function validateAddSurvey()
{
	var form = get('formAddSurvey');
	
	if(!checkField('survey_name', 'Please enter a name for this survey.')) return false;
	if(!checkField('start_date', 'Please enter start date.')) return false;
	if(!checkField('end_data', 'Please enter end date.')) return false;
	
	form.submit();
}

function validateEditSurvey()
{
	var form = get('formEditSurvey');
	
	if(!checkField('survey_name', 'Please enter a name for this survey.')) return false;
	if(!checkField('start_date', 'Please enter start date.')) return false;
	if(!checkField('end_date', 'Please enter end date.')) return false;
	
	form.submit();
}

function validateAddUserGroup()
{
	var form = get('formAddUserGroup');
	
	if(!checkField('group_name', 'Please enter a name for this user group.')) return false;
	
	form.submit();
}

function validateEditUserGroup()
{
	var form = get('formEditUserGroup');
	
	if(!checkField('group_name', 'Please enter a name for this user group.')) return false;
	
	form.submit();
}

function validateAddUserLink()
{
	var form = get('formAddUserLink');
	alert(form);
	form.submit();
	
	if(!checkField('title', 'Please enter the name of the link.')) return false;
	if(!checkField('location', 'Please enter the target of the link when it is clicked.')) return false;
	if(!checkField('weight', 'Please enter the weight of the link. It will be used to order your links.')) return false;
	
	form.submit();
}

function validateEditUserLink(user_id, link_id)
{
	var form = get('formEditUserLink');
	
	if(!checkField('title', 'Please enter the name of the link.')) return false;
	if(!checkField('location', 'Please enter the target of the link when it is clicked.')) return false;
	if(!checkField('weight', 'Please enter the weight of the link. It will be used to order your links.')) return false;
	
	form.submit();
}

function validateFPTSAddProspect()
{
	var form = get('formFPTSAddProspect');
	
	form.submit();
}

function validateFPTSEditProspect()
{
	var form = get('formFPTSEditProspect');
	
	form.submit();
}

function validateFPTSAddEditNote()
{
	var form = get('formFPTSAddEditNote');
	
	form.submit();
}

function validateFPTSAddEditWorkflow()
{
	var form = get('formFPTSAddEditWorkflow');
	
	form.submit();
}

function validateFPTSCloseWorkflow()
{
	var form = get('formFPTSCloseWorkflow');
	
	if(!checkField('closed_note', 'Please type in a note for completing this task.')) return false;
	
	form.submit();
}

function validateEBlastAddList()
{
	var form = get('formEBlastAddList');
	
	if(!checkField('list_name', 'Please enter the name of this list.')) return false;
	
	form.submit();
}

function validateEBlastEditList()
{
	var form = get('formEBlastEditList');
	
	if(!checkField('list_name', 'Please enter the name of this list.')) return false;
	
	form.submit();
}

function validateDRAAddUpdateCopier()
{
	var form = get('formDRAAddUpdateCopier');
	
	if(!checkField('copier_name', 'Please enter the name for this copier.')) return false;
	
	form.submit();
}

function validateDRAAddUpdateDesktop()
{
	var form = get('formDRAAddUpdateDesktop');
	
	if(!checkField('desktop_user', 'Please enter the individual who is using this desktop.')) return false;
	if(!checkField('manufacturer', 'Please enter the manufacturer.')) return false;
	if(!checkField('service_model', 'Please enter the Service Tag / Model No.')) return false;
	if(!checkField('purchase_year', 'Please enter the year of purchase.')) return false;
	if(!checkField('operating_system', 'Please enter the operating system.')) return false;
	
	form.submit();
}

function validateDRAAddUpdateLaptop()
{
	var form = get('formDRAAddUpdateLaptop');
	
	if(!checkField('laptop_user', 'Please enter the individual who is using this laptop.')) return false;
	if(!checkField('manufacturer', 'Please enter the manufacturer.')) return false;
	if(!checkField('service_model', 'Please enter the Service Tag / Model No.')) return false;
	if(!checkField('purchase_year', 'Please enter the year of purchase.')) return false;
	if(!checkField('operating_system', 'Please enter the operating system.')) return false;
	
	form.submit();
}

function validateDRAAddUpdateNetwork()
{
	var form = get('formDRAAddUpdateNetwork');
	
	form.submit();
}

function validateDRAAddUpdatePrinter()
{
	var form = get('formDRAAddUpdatePrinter');
	
	if(!checkField('printer_name', 'Please enter the name for this printer.')) return false;
	
	form.submit();
}

function validateDRAAddUpdateScanner()
{
	var form = get('formDRAAddUpdateScanner');
	
	if(!checkField('scanner_name', 'Please enter the name for this scanner.')) return false;
	
	form.submit();
}

function validateDRAAddUpdateServer()
{
	var form = get('formDRAAddUpdateServer');
	
	if(!checkField('manufacturer', 'Please enter the manufacturer.')) return false;
	if(!checkField('service_model', 'Please enter the Service Tag / Model No.')) return false;
	if(!checkField('purchase_year', 'Please enter the year of purchase.')) return false;
	if(!checkField('operating_system', 'Please select the operating system.')) return false;
	
	form.submit();
}

function validateReportsUploadData()
{
    var form = get('formReportsUploadData');
    
    if(!checkField('month', 'Please type in the month.')) return false;
    if(!checkField('year', 'Please type in the year.')) return false;
    
    form.submit();
}

function validateReportsAddEditReportStatus()
{
	var form = get('formReportsAddEditReportStatus');
	
	if(!checkField('status_note', 'Please type in a status note.')) return false;
	
	form.submit();
}

function validateNewsAddEditNews()
{
	var form = get('formNewsAddEditNews');
	
	if(!checkField('title', 'Please type in a title for this news.')) return false;
	if(!checkField('content', 'Please type in content for this news.')) return false;
	if(!checkField('news_date', 'Please choose the date for this news.')) return false;
	
	form.submit();
}

function validateEventsAddEditEvent()
{
	var form = get('formEventsAddEditEvent');
	
	if(!checkField('title', 'Please type in a title for this event.')) return false;
	if(!checkField('location', 'Please type in a location for this event.')) return false;
	if(!checkField('schedule_date', 'Please choose the start date for this event.')) return false;
	if(!checkField('end_date', 'Please choose the end date for this event.')) return false;
	if(!checkField('self_destruct_after_date', 'Please choose the date on which the date will stop displaying.')) return false;
	
	form.submit();
}

function validateRBannersAddEditBanner()
{
	var form = get('formRBannersAddEditBanner');
	
	if(!checkField('small_title', 'Please type in a short title for this banner, that will display on its button.')) return false;
	if(!checkField('title', 'Please type in a title for this event.')) return false;
	if(!checkField('weight', 'Please type in weight (order) for this banner.')) return false;
	
	form.submit();
}

function validateRBannersSaveSettings()
{
	var form = get('formRBannersSettings');
	
	if(!checkField('rbanners_rotation_interval', 'Please type in rotation interval in seconds.')) return false;
	
	form.submit();
}

function validateUserAddEditFirm()
{
	var form = get('formUserAddEditFirm');
	
	if(!checkField('firm_name', 'Please type in the firm name.')) return false;
	
	form.submit();
}

function validateUserAddEditUser()
{
	var form = get('formUserAddEditUser');
	
	if(!checkField('sso', 'Please type in a SSO.')) return false;
	if(!checkField('user_id', 'Please type in a username.')) return false;
	if(!checkField('password', 'Please type in a password.')) return false;
	if(!checkField('rep_password', 'Please repeat the password.')) return false;
	if(!checkField('FName', 'Please type in the First Name.')) return false;
	if(!checkField('LName', 'Please type in the Last Name.')) return false;
	if(!checkField('email', 'Please type in the E-Mail.')) return false;
	if(!checkField('type', 'Please select a user type.')) return false;
	
	form.submit();
}

function validateLaserficheAddEditFirmData()
{
	var form = get('formLaserficheAddEditFirmData');
	
	if(!checkField('base_fee', 'Please type in the base fee.')) return false;
	//if(!checkField('data_usage', 'Please type in the data usage.')) return false;
	//if(!checkField('invoice_date', 'Please type in the invoice date.')) return false;
	
	form.submit();
}

function validateLaserficheAddEditStorage()
{
	var form = get('formLaserficheAddEditStorage');
	
	if(!checkField('firm_id', 'Please select a firm.')) return false;
	if(!checkField('file_name', 'Please type in a file name.')) return false;
	if(!checkField('file_path', 'Please type in the actual filename.')) return false;
	if(!checkField('file_start_date', 'Please select a From date.')) return false;
	if(!checkField('file_end_date', 'Please select a To date.')) return false;
	
	form.submit();
}

function confirmDeleteCategory(category_id)
{
	if(confirm('Are you sure you want to delete that category?'))
		goTo('?action=marketingAdmin_deleteCategory&category_id=' + category_id);
	else
		return false;
}

function confirmDeleteTemplate(category_id, template_id)
{
	if(confirm('Are you sure you want to delete that template?'))
		goTo('?action=marketingAdmin_deleteTemplate&category_id=' + category_id + '&template_id=' + template_id);
	else
		return false;
}

function confirmDeleteUserTemplate(template_id)
{
	if(confirm('Are you sure you want to delete that template?'))
		goTo('?action=marketing_deleteUserTemplate&template_id=' + template_id);
	else
		return false;
}

function confirmDeleteSurveyCategory(category_id)
{
	if(confirm('Are you sure you want to delete this category?'))
		goTo('?action=surveyAdmin_deleteCategory&category_id=' + category_id);
	else
		return false;
}

function confirmDeleteQuestionCategory(category_id)
{
	if(confirm('Are you sure you want to delete this category?'))
		goTo('?action=surveyAdmin_deleteQuestionCategory&category_id=' + category_id);
	else
		return false;
}

function confirmDeleteSurvey(survey_id)
{
	if(confirm('Are you sure you want to delete this survey?'))
		goTo('?action=surveyAdmin_deleteSurvey&survey_id=' + survey_id);
	else
		return false;
}

function confirmDeleteUser(id)
{
	if(confirm('Are you sure you want to delete this user? This action is permanent and can not be undone!'))
		if(confirm('Deleting this user will make unaccessible all his personal data like reports and activities. Are you sure?'))
			goTo('?action=userAdmin_deleteUser&id=' + id);
		else
			return false;
	else
		return false;
}

function confirmDeleteFirm(firm_id)
{
	if(confirm('Are you sure you want to delete this firm? All advisors assigned to it will need to be reassigned.'))
		goTo('?action=userAdmin_deleteFirm&firm_id=' + firm_id);
	else
		return false;
}

function confirmDeleteUserGroup(group_id)
{
	if(confirm('Are you sure you want to delete this user group?'))
		goTo('?action=surveyAdmin_deleteUserGroup&group_id=' + group_id)
	else
		return false;
}

function confirmDeleteUserLink(link_id)
{
	if(confirm('Are you sure you want to delete this link?'))
		goTo('?action=showMyProfile&tab=5&subaction=deleteUserLink&link_id=' + link_id);
	else
		return false;
}

function confirmFPTSDeleteProspect(prospect_id)
{
	if(confirm('Are you sure you want to delete this prospect?'))
		goTo('?action=fpts_deleteProspect&prospect_id=' + prospect_id);
	else
		return false;
}

function confirmFPTSDeleteNote(prospect_id, note_id)
{
	if(confirm('Are you sure you want to delete this note?'))
		goTo('?action=fpts_deleteNote&prospect_id=' + prospect_id + '&note_id=' + note_id);
	else
		return false;
}

function confirmEBlastDeleteList(list_id)
{
	if(confirm('Are you sure you want to delete this list?'))
		goTo('?action=eblast_deleteList&list_id=' + list_id);
	else
		return false;
}

function confirmDRADeleteCopier(copier_id)
{
	if(confirm('Are you sure you want to delete this copier?'))
		goTo('?action=dra_deleteCopier&copier_id=' + copier_id);
	else
		return false;
}

function confirmDRADeleteDesktop(desktop_id)
{
	if(confirm('Are you sure you want to delete this desktop?'))
		goTo('?action=dra_deleteDesktop&desktop_id=' + desktop_id);
	else
		return false;
}

function confirmDRADeleteLaptop(laptop_id)
{
	if(confirm('Are you sure you want to delete this laptop?'))
		goTo('?action=dra_deleteLaptop&laptop_id=' + laptop_id);
	else
		return false;
}

function confirmDRADeleteNetwork(network_id)
{
	if(confirm('Are you sure you want to delete this network?'))
		goTo('?action=dra_deleteNetwork&network_id=' + network_id);
	else
		return false;
}

function confirmDRADeletePrinter(printer_id)
{
	if(confirm('Are you sure you want to delete this printer?'))
		goTo('?action=dra_deletePrinter&printer_id=' + printer_id);
	else
		return false;
}

function confirmDRADeleteScanner(scanner_id)
{
	if(confirm('Are you sure you want to delete this scanner?'))
		goTo('?action=dra_deleteScanner&scanner_id=' + scanner_id);
	else
		return false;
}

function confirmDRADeleteServer(server_id)
{
	if(confirm('Are you sure you want to delete this server?'))
		goTo('?action=dra_deleteServer&server_id=' + server_id);
	else
		return false;
}

function confirmFPTSDeleteWorkflow(prospect_id, workflow_id)
{
	if(confirm('Are you sure you want to delete this task?'))
		goTo('?action=fpts_deleteWorkflow&prospect_id=' + prospect_id + '&workflow_id=' + workflow_id);
	else
		return false;
}

function confirmNewsDeleteNews(news_id)
{
	if(confirm('Are you sure you want to delete this news?'))
		goTo('?action=newsAdmin_deleteNews&news_id=' + news_id);
	else
		return false;
}

function confirmEventsDeleteEvent(event_id)
{
	if(confirm('Are you sure you want to delete this event?'))
		goTo('?action=eventsAdmin_deleteEvent&event_id=' + event_id);
	else
		return false;
}

function confirmRBannersDeleteBanner(banner_id)
{
	if(confirm('Are you sure you want to delete this banner?'))
		goTo('?action=rbannersAdmin_deleteBanner&banner_id=' + banner_id);
	else
		return false;
}

function confirmReportsDeleteReportStatus(status_id)
{
	if(confirm('Are you sure you want to delete this status?'))
		goTo('?action=reportsAdmin_deleteReportStatus&status_id=' + status_id);
	else
		return false;
}

function confirmLaserficheDeleteFirmData(data_id)
{
	if(confirm('Are you sure you want to delete this firm data?'))
		goTo('?action=laserficheAdmin_deleteFirmData&data_id=' + data_id);
	else
		return false;
}

function confirmLaserficheDeleteStorage(storage_id)
{
	if(confirm('Are you sure you want to delete this storage entry? Keep in mind that the actual file will not be removed.'))
		goTo('?action=laserficheAdmin_deleteStorage&storage_id=' + storage_id);
	else
		return false;
}

function confirmTasksDeleteCategory(category_id)
{
	if(confirm('Are you sure you want to delete this category?'))
		goTo('?action=tasksAdmin_deleteCategory&category_id=' + category_id);
	else
		return false;
}

function confirmTasksDeleteNote(user_id, note_id)
{
	if(confirm('Are you sure you want to delete this note?'))
		goTo('?action=tasksAdmin_deleteNote&user_id=' + user_id + '&note_id=' + note_id);
	else
		return false;
}

function confirmTasksDeleteTask(user_id, task_id)
{
	if(confirm('Are you sure you want to delete this task?'))
		goTo('?action=tasksAdmin_deleteTask&user_id=' + user_id + '&task_id=' + task_id);
	else
		return false;
}

function confirmTasksDeleteProjectTask(project_id)
{
	if(confirm('Are you sure you want to delete this project?'))
		goTo('?action=tasksAdmin_deleteProjectTask&project_id=' + project_id);
	else
		return false;
}