//the functions below help us open windows real quick
var DefaultWindowOptions = 'status=no,scrollbars=yes,resizable=yes,width=700,height=400';

//-----------------------------------------------------------------//
//front end windows


//-----------------------------------------------------------------//
//back end windows
	//admin
	function OpenEmployee(employee_id) {
		window.open('/admin/employees.aspx?r=add_edit&employee_id='+ employee_id, 'Employee', DefaultWindowOptions);
	}
	function OpenStatusOption(status_option_id) {
		window.open('/admin/status_options.aspx?r=add_edit&status_option_id='+ status_option_id, 'StatusOption', DefaultWindowOptions);
	}
	function OpenCustomer(customer_id) {
		window.open('/admin/customers.aspx?r=add_edit&customer_id='+ customer_id, 'Customer', DefaultWindowOptions.replace("width=700,height=400","width=800,height=400"));
	}
	// Charlie added 08-08-08 - Used to review an incomplete Survey where an Order may not exist.
	function OpenSurveyReview(survey_customer_id) {
		window.open('/admin/orders/orders.aspx?r=review_survey_only&survey_customer_id='+ survey_customer_id, 'Survey', DefaultWindowOptions.replace("width=700,height=400","width=800,height=700"));
	}
	function OpenEmail(email_id) {
		window.open('/admin/emails.aspx?r=add_edit&email_id='+ email_id, 'Email', DefaultWindowOptions.replace("width=700,height=400","width=1000,height=500"));
	}
	function OpenDiscountCode(discount_id) {
		window.open('/admin/discounts.aspx?r=add_edit&discount_id='+ discount_id, 'Discount', DefaultWindowOptions);
	}
	function OpenPackage(package_id) {
		window.open('/admin/packages.aspx?r=add_edit&package_id='+ package_id, 'Package', DefaultWindowOptions);
	}
	function OpenLibraryCategory(category_id) {
		window.open('/admin/library_categories.aspx?r=add_edit&library_category_id='+ category_id, 'LibraryCategory', DefaultWindowOptions.replace("width=700,height=400","width=800,height=600"));
	}
	
	//admin/survey/survey_builder.aspx
	function OpenLineItem(line_item_id, survey_id) {
		window.open('/admin/survey/survey_builder.aspx?r=add_edit_line_item&survey_id=' + survey_id + '&line_item_id=' + line_item_id, 'LineItem', DefaultWindowOptions);
	}	
	function OpenSurvey(survey_id) {
		window.open('/admin/survey/survey_builder.aspx?r=survey_menu&survey_id='+ survey_id, 'Survey','status=no,scrollbars=yes,resizable=yes,width=1000,height=650');
	}
	function OpenSurveyDetails(survey_id) {
		alert ("This is a place-holder alert");
	}
	function OpenPage(page_id,survey_id) {
		window.open('/admin/survey/survey_builder.aspx?r=add_edit_page&survey_page_id='+ page_id + '&survey_id=' + survey_id, 'EditPage', DefaultWindowOptions.replace("width=700,height=400","width=800,height=600"));
	}
	function OpenSet(set_id, page_id) {
		window.open('/admin/survey/survey_builder.aspx?r=add_edit_set&survey_set_id='+ set_id + '&survey_page_id=' + page_id, 'EditSet', DefaultWindowOptions.replace("width=700,height=400","width=800,height=600"));
	}
	function OpenField(field_id, set_id) {
		window.open('/admin/survey/survey_builder.aspx?r=add_edit_field&survey_field_id=' + field_id + '&survey_set_id=' + set_id, 'EditField', DefaultWindowOptions.replace("width=700,height=400","width=800,height=600"));
	}
	function OpenPackageManager(package_id) {
		window.open('/admin/package_manager.aspx?r=add_edit&package_id='+ package_id, 'AddEditPackage', DefaultWindowOptions);
	}
	function OpenDataEntry(user_id) {
		window.open('/admin/survey/data_entry_reps.aspx?r=add_edit&user_id='+ user_id, 'DataEntryUser', DefaultWindowOptions);
	}
	function OpenDataEntryOrganization(organization_id) {
		window.open('/admin/survey/data_entry_organizations.aspx?r=add_edit&organization_id='+ organization_id, 'DataEntryOrganization', DefaultWindowOptions);
	}	
	function OpenSurveyCategory(category_id) {
		window.open('/admin/survey/manage_survey_categories.aspx?r=add_edit&survey_category_id='+ category_id, 'SurveyCategory', DefaultWindowOptions.replace("width=700,height=400","width=800,height=600"));
	}
	function OpenOrder(id) {
		window.open('/admin/orders/orders.aspx?r=add_edit&order_id='+ id, 'AddEditOrder', DefaultWindowOptions.replace("width=700,height=400","width=800,height=600"));
	}
	function OpenBillingHistory(id){
		window.open('/admin/orders/orders.aspx?r=billing_history&order_id='+ id, 'BillingHistory', DefaultWindowOptions.replace("width=700,height=400","width=800,height=600"));
	}
	function OpenOrderSurveys(id) {
		window.open('/admin/orders/orders.aspx?r=surveys&order_id='+ id, 'OrderSurveys', DefaultWindowOptions.replace("width=700,height=400","width=800,height=600"));
	}	
	function EditFile(file_id) {
		window.open('/admin/survey/survey_builder.aspx?r=edit_file&file_id='+ file_id, 'EditFile', DefaultWindowOptions.replace("width=700,height=400","width=800,height=600"));
	}
	function EditFieldMapping(field_mapping_id) {
		window.open('/admin/survey/survey_builder.aspx?r=edit_field_mapping&field_mapping_id=' + field_mapping_id, 'EditFieldMapping', DefaultWindowOptions.replace("width=700,height=400","width=800,height=600"));
	}
	function EditPredefinedFieldMapping(field_mapping_id) {
		window.open('/admin/survey/survey_builder.aspx?r=edit_predefined_field_mapping&field_mapping_id='+ field_mapping_id, 'EditFieldMapping', DefaultWindowOptions.replace("width=700,height=400","width=800,height=600"));
	}	
	function OpenProcedure(type,procedure_id, trigger_id) {
		window.open('/admin/survey/survey_builder.aspx?r=' + type + '&procedure_id=' + procedure_id + "&trigger_id=" + trigger_id, 'AddEditProcedure', DefaultWindowOptions.replace("width=700,height=400","width=800,height=600"));
	}
	function OpenFieldMappingProcedure(procedure_id, trigger_id) {
		window.open('/admin/survey/survey_builder.aspx?r=add_edit_field_mapping_procedure&procedure_id=' + procedure_id + "&trigger_id=" + trigger_id, 'AddEditProcedure', DefaultWindowOptions.replace("width=700,height=400","width=800,height=600"));
	}
	function OpenSurveyProcedure(procedure_id, trigger_id){
		window.open('/admin/survey/survey_builder.aspx?r=add_edit_survey_procedure&procedure_id=' + procedure_id + "&trigger_id=" + trigger_id, 'AddEditProcedure', DefaultWindowOptions.replace("width=700,height=400","width=800,height=600"));
	}
	function OpenTrigger(trigger_id, survey_id) {
		window.open('/admin/survey/survey_builder.aspx?r=add_edit_trigger&trigger_id='+ trigger_id + "&survey_id=" + survey_id, 'EditTrigger', DefaultWindowOptions.replace("width=700,height=400","width=800,height=600"));
	}	
	function OpenCalculatedField(calculated_field_id, survey_id) {
		window.open('/admin/survey/survey_builder.aspx?r=add_edit_calculated_field&calculated_field_id='+ calculated_field_id + "&survey_id=" + survey_id, 'EditCalculatedField', DefaultWindowOptions.replace("width=700,height=400","width=800,height=600"));
	}	
	function OpenCalculatedField(calculated_field_id, survey_id) {
		window.open('/admin/survey/survey_builder.aspx?r=add_edit_calculated_field&calculated_field_id='+ calculated_field_id + "&survey_id=" + survey_id, 'EditCalculatedField', DefaultWindowOptions.replace("width=700,height=400","width=800,height=600"));
	}
	function PreviewSurvey(ref_id) {
		window.open('/account/surveys.aspx?r=preview_survey&ref_id='+ ref_id, 'PreviewSurvey', DefaultWindowOptions.replace("width=700,height=400","width=800,height=600"));
	}
	function ViewDocument(survey_customer_id,file_id) {
		window.open('/admin/_generate_pdf.aspx?r=generate_document&survey_customer_id='+ survey_customer_id + '&file_id='+ file_id, 'ViewDocument', DefaultWindowOptions.replace("width=700,height=400","width=800,height=600"));
	}
	function OpenManualEntry(field_mapping_id, survey_file_id, survey_customer_id) {
		window.open('/admin/orders/orders.aspx?r=add_edit_manual_entry&field_mapping_id='+ field_mapping_id + "&survey_file_id=" + survey_file_id + "&survey_customer_id=" + survey_customer_id, 'AddEditManualEntry', DefaultWindowOptions.replace("width=700,height=400","width=800,height=600"));
	}
	function CompileDocuments(survey_customer_id) {
		window.open('/admin/_generate_pdf.aspx?r=compile_documents&survey_customer_id='+ survey_customer_id, 'CompileDocuments', DefaultWindowOptions.replace("width=700,height=400","width=800,height=600"));
	}
	function OpenGlossary(glossary_id) {
		window.open('/admin/survey/glossary.aspx?r=add_edit&glossary_id='+ glossary_id, 'AddEditGlossary', DefaultWindowOptions.replace("width=700,height=400","width=800,height=600"));
	}
	
	//account
	function OpenCustomerOrder(id) {
		window.open('/account/myorders.aspx?r=view_order&order_id=' + id, 'ViewOrder', DefaultWindowOptions.replace("width=700,height=400","width=800,height=600"));
	}	
	function OpenServiceAgreement(){
		window.open('/service_agreement.aspx', 'ViewOrder', DefaultWindowOptions.replace("width=700,height=400","width=1000,height=500"));
	}
	//admin/master
	function OpenUser(user_id) {
		window.open('/admin/master/users.aspx?r=add_edit&user_id='+ user_id, 'User', DefaultWindowOptions);
	}
	function OpenUserGroup(group_id) {
		window.open('/admin/master/user_groups.aspx?r=add_edit&group_id='+ group_id, 'UserGroup', DefaultWindowOptions);
	}
	function OpenSecuritySetting(security_id, p_security_id) {
		window.open('/admin/master/security_settings.aspx?r=add_edit&security_id='+ security_id +'&p_security_id='+ p_security_id, 'SecuritySetting', DefaultWindowOptions);
	}
	function OpenAllowedIP(allowed_ip_id) {
		window.open('/admin/master/allowed_ips.aspx?r=add_edit&allowed_ip_id='+ allowed_ip_id, 'AllowedIP', DefaultWindowOptions);
	}
	function OpenError(error_id) {
		window.open('/admin/master/error_snitch.aspx?r=details&error_id='+ error_id, 'ErrorSnitch', DefaultWindowOptions.replace("width=700,height=400","width=800,height=600"));
	}

//-----------------------------------------------------------------//
