window.name = "Aprex";
var arrEventLayer = new Array();
function load_ajax_modules(layer_id){
document.getElementById(layer_id).innerHTML = " ";
}
function uploading_ajax_modules(layer_id){
document.getElementById(layer_id).innerHTML = " ";
}
function insert_ajax_modules(layer_id){
document.getElementById(layer_id).innerHTML = " ";
}
function update_ajax_modules(layer_id){
document.getElementById(layer_id).innerHTML = " ";
}
function import_ajax_modules(layer_id){
document.getElementById(layer_id).innerHTML = " ";
}
function export_ajax_modules(layer_id){
document.getElementById(layer_id).innerHTML = " ";
}
function delete_ajax_modules(layer_id){
document.getElementById(layer_id).innerHTML = " ";
}
function showEventLayer(index_value){
if(index_value){
document.getElementById("event_layer").innerHTML = arrEventLayer[index_value];
}else{
document.getElementById("event_layer").innerHTML = "";
}
}
function showEventLayer_cb(obj){
arrEventLayer = JSON.parse(obj);
}
function divWhiteLoading_ajax(){
document.getElementById("floatLayer").innerHTML = "
";
load_ajax_modules("loadingEditForm");
}
//---------------------------------------------------------------------------------------
function change_calendar_date(layer_form, field, dt, form_id){
f = eval("document." + field);
f.value = dt;
document.getElementById(layer_form).innerHTML = "";
}
//---------------------------------------------------------------------------------------
function call_back_ajax(obj_json){
//alert(obj_json);
var arr_get = JSON.parse(obj_json);
if(arr_get["layer_id"] != "quick_insert"){
close_quick_insert();
}
document.getElementById(arr_get["layer_id"]).innerHTML = arr_get["text_return"];
}
//---------------------------------------------------------------------------------------
function load_inc_calendar(){
x_inc_calendar(inc_calendar_cb);
}
//---------------------------------------------------------------------------------------
function inc_calendar_cb(obj_json){
var arr_get = JSON.parse(obj_json);
document.getElementById("inc_calendar").innerHTML = arr_get["thecalendar"];
}
//---------------------------------------------------------------------------------------
function make_json(form_id, layer_id, id, action_form, tp_form ){
j = eval("document."+ form_id +".length");
var aux = "";
var post_json = new Object;
for (i=0;i 0) {
item_json += ",";
}
item_json += form_field.options[w].value;
}
}
post_json[form_field.name] = item_json;
} else {
post_json[form_field.name] = trim(form_field.value);
}
}
text_json = JSON.stringify(post_json);
/*Update --------------------------------------------------*/
if (action_form == "update"){
if (tp_form == "day" || tp_form == "home_schedule" || tp_form == "month" || tp_form == "week" || tp_form == "year" || tp_form == "event" || tp_form == "schedule_search"){
x_update_proc_schedule_ajax(id, layer_id, text_json, tp_form, form_id, update_proc_schedule_ajax_cb);
}else if(tp_form == "contact"){
x_update_proc_contact_ajax(id, layer_id, text_json, update_proc_contact_ajax_cb);
}else if(tp_form == "forum"){
x_update_proc_forum_ajax(text_json, update_proc_forum_ajax_cb);
}else if(tp_form == "poll"){
p = confirm("Todas as respostas serão apagadas. Você tem certeza de que deseja alterar a enquete?");
if(p){
x_update_proc_poll_ajax(id, layer_id, text_json, update_proc_poll_ajax_cb);
}
}else if(tp_form == "user"){
x_update_proc_user_ajax(id, layer_id, text_json, update_proc_user_ajax_cb);
}else if(tp_form == "update_email_user"){
x_update_email_user_proc(id, layer_id, text_json, update_email_user_proc_cb);
}else if(tp_form == "update_email_user_admin"){
x_update_email_user_admin_proc(id, layer_id, text_json, update_admin_emailuser);
}else if(tp_form == "account"){
x_update_proc_account_ajax(id, layer_id, text_json, update_proc_account_ajax_cb);
}else if(tp_form == "password"){
x_update_password_proc_ajax(id, layer_id, text_json, update_password_proc_ajax_cb);
}else if(tp_form == "task"){
x_update_proc_task_ajax(id, layer_id, text_json, update_proc_task_ajax_cb);
} else if(tp_form == "task_remember"){
x_update_proc_task_remember_ajax(id, layer_id, text_json, update_proc_task_remember_ajax_cb);
}else if(tp_form == "client"){
x_update_proc_client_ajax(id, layer_id, text_json, update_proc_client_ajax_cb);
}else if(tp_form == "notepad"){
x_update_proc_notepad_ajax(id, layer_id, text_json, update_proc_notepad_ajax_cb);
}else if(tp_form == "websites"){
x_update_proc_website_ajax(text_json, id, layer_id, update_proc_websites_ajax_cb);
}else if(tp_form == "websites_page"){
x_update_proc_websites_page_ajax(text_json, layer_id, update_proc_websites_page_cb);
}else if(tp_form == "websites_item"){
x_update_proc_websites_item_ajax(text_json, id, update_proc_websites_item_ajax_cb);
}else if(tp_form == "virtual_disc"){
x_update_proc_virtual_disc_ajax(id, layer_id, text_json, update_proc_virtual_disc_ajax_cb);
}else if(tp_form == "presentation"){
x_update_proc_presentation_slide_mestre(id, layer_id, text_json, update_proc_presentation_slide_mestre_cb);
}else if(tp_form == "presentation_page"){
x_update_proc_presentation_page_ajax(id, layer_id, text_json, update_proc_presentation_page_ajax_cb);
}else if(tp_form == "presentation_participants"){
x_update_participants_proc(id, layer_id, text_json, update_participants_proc_cb);
}else if(tp_form == "email_marketing"){
x_update_form_proc_email_marketing(id, layer_id, text_json, update_form_proc_email_marketing_cb);
}else if(tp_form == "email_marketing_body"){
x_update_form_proc_email_marketing_body(id, layer_id, text_json, insert_form_proc_email_marketing_body_cb);
}else if(tp_form == "email_marketing_step2"){
x_insert_step_2_proc_email_marketing(id, layer_id, text_json, insert_step_2_proc_email_marketing_cb);
}else if(tp_form == "email_marketing_list"){
x_email_marketing_list_proc(id, layer_id, text_json, email_marketing_list_proc_cb);
}else if(tp_form == "email_marketing_send"){
x_update_form_proc_email_marketing_send(id, layer_id, text_json, update_form_proc_email_marketing_send_cb);
}else if(tp_form == "email_marketing_participants"){
x_update_participants_email_marketing_proc(id, layer_id, text_json, update_participants_email_marketing_proc_cb);
}else if(tp_form == "fast_reply"){
x_update_proc_fast_reply(id, text_json, update_proc_fast_reply_cb);
}else if(tp_form == "user_admin"){
x_update_proc_user_admin_ajax(id, layer_id, text_json, update_proc_user_admin_ajax_cb);
}else if(tp_form == "contact_label"){
x_update_proc_contact_label(id, text_json, update_proc_contact_label_cb);
}else if(tp_form == "plan"){
x_update_plan_ajax(text_json, update_plan_ajax_cb);
}else if(tp_form == "news"){
x_update_proc_news(id, text_json, update_proc_news_cb);
}else if(tp_form == "favorites"){
x_update_proc_favorites_ajax(id, text_json, update_proc_favorites_ajax_cb);
}else if(tp_form == "billing_admin"){
x_edit_proc_billing_admin_ajax(layer_id, id, text_json, edit_proc_billing_admin_ajax_cb);
}else if(tp_form == "virtual_disc_folder"){
x_change_folder_name(text_json, change_folder_name_cb);
}else if(tp_form == "partner"){
x_update_proc_partner(id, text_json, update_proc_partner_cb);
}else if(tp_form == "edit_billing_data_admin"){
x_edit_proc_billing_data_ajax(id, layer_id, text_json, edit_proc_billing_data_ajax_cb);
}else if(tp_form == "admin_user"){
x_update_proc_admin_user(id, text_json, update_proc_admin_user_cb);
}else if(tp_form == "faq"){
x_update_proc_faq_ajax(text_json, id, layer_id, update_proc_faq_ajax_cb);
}else if(tp_form == "faq_category"){
x_update_proc_faq_category_ajax(text_json, id, layer_id, update_proc_faq_category_ajax_cb);
}else if(tp_form == "igmail"){
x_update_proc_data_igmail(text_json, insert_proc_data_igmail_cb);
}else if(tp_form == "language"){
x_update_proc_language(text_json, update_proc_language_cb);
}else if(tp_form == "task_client"){
x_update_proc_task_client_ajax(id, layer_id, text_json, update_proc_task_client_ajax_cb);
}else if(tp_form == "gmt"){
x_update_gmt_ajax(text_json, update_gmt_ajax_cb);
}else if(tp_form == "email_marketing_edit_list_recipient"){
x_edit_detais_recipient_proc(id, text_json, layer_id, call_back_ajax);
}
/*Preview Presentation*/
}else if(action_form == "preview_presentation"){
x_preview_xml(id, text_json, '', preview_xml_cb);
/*Presentation Public --------------------------------------------------*/
}else if(action_form == "presentation_public"){
x_get_form_proc_public(id, layer_id, text_json, get_form_proc_public_cb);
/*Schedule Check --------------------------------------------------*/
}else if (action_form == "check"){
x_verify_schedule(id, layer_id, text_json, action_form, verify_schedule_cb);
/*Insert --------------------------------------------------*/
} else if (action_form == "insert"){
if (tp_form == "day" || tp_form == "home_schedule" || tp_form == "month" || tp_form == "week" || tp_form == "year" || tp_form == "event" || tp_form == "schedule_search"){
x_insert_proc_schedule_ajax(layer_id, text_json, tp_form, form_id, insert_proc_schedule_ajax_cb);
}else if(tp_form == "poll_home"){
x_insert_poll_form_ajax(id, text_json, insert_poll_form_ajax_cb);
}else if(tp_form == "poll"){
x_insert_proc_poll_ajax(text_json, insert_proc_poll_ajax_cb);
}else if(tp_form == "contact"){
x_insert_proc_contact_ajax(text_json, insert_proc_contact_ajax_cb);
}else if(tp_form == "forum"){
x_insert_proc_forum_ajax(text_json, insert_proc_forum_ajax_cb);
}else if(tp_form == "comment" || tp_form == "search_forum_comment"){
x_comment_proc_forum_ajax(layer_id, id, text_json, tp_form, comment_proc_forum_ajax_cb);
}else if(tp_form == "user"){
x_insert_proc_user_ajax(text_json, insert_proc_user_ajax_cb);
}else if(tp_form == "client"){
x_insert_proc_client_ajax(text_json, insert_proc_client_ajax_cb);
}else if(tp_form == "quick_client"){
x_add_proc_client_ajax(text_json, add_proc_client_ajax_cb);
}else if(tp_form == "quick_user"){
x_add_proc_user_ajax(text_json, add_proc_user_ajax_cb);
}else if(tp_form == "notepad"){
x_insert_proc_notepad_ajax(text_json, insert_proc_notepad_ajax_cb);
}else if(tp_form == "quick_note"){
x_insert_proc_notepad_ajax(text_json, quick_note_proc_ajax_cb);
}else if(tp_form == "presentation"){
x_insert_proc_presentation_ajax(text_json, insert_proc_presentation_ajax_cb);
}else if(tp_form == "presentation_page"){
x_insert_proc_presentation_page_ajax(text_json, insert_proc_presentation_page_ajax_cb);
}else if(tp_form == "presentation_step3"){
x_insert_proc_presentation_step3_ajax(text_json, id, insert_proc_presentation_step3_ajax_cb);
}else if(tp_form == "task"){
x_insert_proc_task_ajax(text_json, insert_proc_task_ajax_cb);
}else if(tp_form == "websites"){
x_new_proc_website_ajax(text_json, layer_id, new_proc_website_ajax_cb);
}else if(tp_form == "websites_item"){
x_insert_proc_item_ajax(text_json, layer_id, insert_proc_item_ajax_cb);
}else if(tp_form == "websites_page"){
x_insert_proc_pages_ajax(text_json, layer_id, insert_proc_pages_ajax_cb);
}else if(tp_form == "task_notes"){
x_insert_task_notes_ajax(text_json, insert_task_notes_ajax_cb);
}else if(tp_form == "email_marketing"){
x_insert_form_proc_email_marketing(text_json, insert_form_proc_email_marketing_cb);
}else if(tp_form == "email_marketing_body"){
x_insert_form_proc_email_marketing_body(text_json, id, layer_id, insert_form_proc_email_marketing_body_cb);
}else if(tp_form == "email_marketing_step4"){
x_insert_step_4_proc_email_marketing(text_json, insert_step_4_proc_email_marketing_cb);
}else if(tp_form == "email_marketing_list"){
x_email_marketing_list_proc(id, layer_id, text_json, email_marketing_list_proc_cb);
}else if(tp_form == "email_marketing_list_more_emails"){
x_email_marketing_list_more_emails_proc(id, layer_id, text_json, email_marketing_list_more_emails_proc_cb);
}else if(tp_form == "fast_reply"){
x_insert_proc_fast_reply(text_json, insert_proc_fast_reply_cb);
}else if(tp_form == "reply"){
x_reply_email_proc(id, text_json, reply_email_proc_cb);
}else if(tp_form == "new_reply"){
x_new_reply_email_proc(id, text_json, reply_email_proc_cb);
}else if(tp_form == "mark_reply"){
x_mark_as_replyed(id, text_json, reply_email_proc_cb);
}else if(tp_form == "account_user_search"){
x_search_account_user(text_json, search_account_user_cb);
}else if(tp_form == "fast_reply_send_email"){
x_send_email_activation(layer_id, text_json, call_back_ajax);
}else if(tp_form == "contact_label"){
x_insert_proc_contact_label(text_json, insert_proc_contact_label_cb);
}else if(tp_form == "news"){
x_insert_proc_news(text_json, insert_proc_news_cb);
}else if(tp_form == "favorites"){
x_insert_proc_favorites_ajax(text_json, insert_proc_favorites_ajax_cb);
}else if(tp_form == "rough_draft"){
x_rough_draft_proc_ajax(text_json, rough_draft_proc_ajax_cb);
}else if(tp_form == "virtual_disc_folder"){
x_new_folder(text_json, new_folder_cb);
}else if(tp_form == "partner"){
x_insert_proc_partner(text_json, insert_proc_partner_cb);
}else if(tp_form == "give_discount_admin"){
x_give_discount_proc(id, layer_id, text_json, give_discount_proc_cb);
}else if(tp_form == "admin_user"){
x_insert_proc_admin_user(text_json, insert_proc_admin_user_cb);
}else if(tp_form == "igmail"){
x_insert_proc_data_igmail(text_json, insert_proc_data_igmail_cb);
}else if(tp_form == "faq"){
x_insert_proc_faq_ajax(text_json, id, layer_id, insert_proc_faq_ajax_cb);
}else if(tp_form == "faq_category"){
x_insert_proc_faq_category_ajax(text_json, id, layer_id, insert_proc_faq_category_ajax_cb);
}else if(tp_form == "task_client"){
x_insert_proc_task_client_ajax(text_json, layer_id, insert_proc_task_client_ajax_cb);
}
/*Delete*/
} else if (action_form == "delete"){
if (tp_form == "remove_emails"){
x_remove_emails_selected(text_json, id, layer_id, remove_emails_selected_cb);
}
/*Poll option --------------------------------------------------*/
} else if (action_form == "option"){
x_insert_options_poll_ajax(id, layer_id, text_json, tp_form, call_back_ajax);
/*Reset poll --------------------------------------------------*/
} else if (action_form == "update_reset"){
x_update_proc_poll_reset(id, layer_id, text_json, update_proc_poll_ajax_cb);
/*Update result poll --------------------------------------------------*/
} else if (action_form == "update_result"){
x_update_proc_poll_result(id, layer_id, text_json, call_back_ajax);
/*Update date poll--------------------------------------------------*/
} else if (action_form == "update_date"){
x_update_proc_poll_date(id, layer_id, text_json, update_proc_poll_ajax_cb);
/*Send email --------------------------------------------------*/
}else if (action_form == "send_email"){
x_send_email_form(text_json, tp_form , send_email_form_cb);
/*Presentation bullets --------------------------------------------------*/
}else if (action_form == "bullets"){
x_get_form_template_page_bullets(layer_id, id, text_json, tp_form, call_back_ajax);
/*Quick Insert ----------------------------------------------------------*/
}else if(action_form == "quick_insert"){
if(tp_form == "schedule"){
x_insert_proc_schedule_ajax(layer_id, text_json, tp_form, form_id, quick_insert_schedule_proc_cb);
}else if(tp_form == "notepad"){
x_insert_proc_notepad_ajax(text_json, layer_id, quick_insert_notepad_proc_cb);
}else if(tp_form == "favorites"){
x_insert_proc_favorites_ajax(text_json, layer_id, quick_insert_favorites_proc_cb);
}else if(tp_form == "contact"){
x_insert_proc_contact_ajax(text_json, layer_id, quick_insert_contact_proc_cb);
}else if(tp_form == "task"){
x_insert_proc_task_ajax(text_json, layer_id, quick_insert_task_proc_cb);
}
} else if(action_form == "admin_search") {
if (tp_form == "advanced_search") {
x_advanced_search_proc_ajax(text_json, layer_id, advanced_search_proc_ajax_cb);
}
} else if (action_form == "fancy_upload") {
return post_json;
} else if (action_form == "google_docs") {
if (tp_form == "signin") {
x_signin_google_docs_proc(text_json, layer_id, signin_google_docs_proc_cb);
} else if (tp_form == "modify") {
x_modify_registration_google_docs_proc(text_json, layer_id, modify_registration_google_docs_proc_cb);
}
}
}
//---------------------------------------------------------------------------------------
function close_form(layer_id){
document.getElementById(layer_id).innerHTML = "";
}
//---------------------------------------------------------------------------------------
function close_calendar_form_ajax(layer_id, layer_id2){
document.getElementById(layer_id).innerHTML = "";
document.getElementById(layer_id2).innerHTML = "";
}
//---------------------------------------------------------------------------------------
/*Write iframe in page*/
function write_ifm(){
document.getElementById("iframe").innerHTML = '';
}
/*Write iframe in page*/
/*Function Check Hour -------------------------------------*/
function check_hour(value, form_id, field_id){
time_end = eval("document." + form_id + "." + field_id);
for (w=0; w < time_end.length; w++) {
if(time_end.options[w].value == value){
time_end.options[w].selected = true;
}
}
}
/*Function Check Hour -------------------------------------*/
/*Create object from type to*/
function get_combo_group_list(form_id, layer_id, id, obj){
var post_json = new Object;
post_json["public"] = false;
post = false;
f = eval("document." + form_id);
/*if(f.public.checked == true){
post = true;
}else{
document.getElementById(layer_id).innerHTML = "";
post = false;
}*/
if(obj.checked == true){
post = true;
post_json[obj.name] = true;
document.getElementById(layer_id).innerHTML = " ";
}else{
post = false;
document.getElementById(layer_id).innerHTML = "";
}
if(post){
document.getElementById("empty_box_" + id).innerHTML = "";
document.getElementById("div_rem_" + id).style.height = 100;
text_json = JSON.stringify(post_json);
document.getElementById("span_box_account_" + id).style.display = "";
//x_get_email_list_group(text_json, layer_id, id, form_id, call_back_ajax);
x_get_email_list_group(text_json, layer_id, id, form_id, generate_group_table);
}else{
document.getElementById("div_rem_" + id).style.height = 25;
document.getElementById("empty_box_" + id).innerHTML = "Selecione os destinatários";
document.getElementById("span_box_account_" + id).style.display = "none";
}
}
/*Create object from type to*/
/*Check all check box*/
function check_all_combo_box(obj, form_id, name_field){
f = eval("document." + form_id);
//field = eval("document." + form_id + "." + name_field);
field = eval("document." + form_id + ".elements['"+ name_field +"']");
if (!field){
return true;
}
if(obj.checked == true){
check = true;
}else{
check = false;
}
if(field.length == undefined){
field.checked = check;
}else{
for (w=0; w < field.length; w++) {
field[w].checked = check;
}
}
}
/*Check all check box*/
/*Check all check box aprex mail*/
function check_all_combo_box_aprex_mail(obj, form_id, name_field, layer_id){
f = eval("document." + form_id);
//field = eval("document." + form_id + "." + name_field);
field = eval("document." + form_id + ".elements['"+ name_field +"']");
if(obj.checked == true){
document.getElementById(layer_id).style.display = "";
check = true;
}else{
check = false;
}
for (w=0; w < field.length; w++) {
field[w].checked = check;
}
}
/*Check all check box aprex mail*/
/*Check all check box*/
function verify_check_all_combo(form_id, name_field, name_field_all){
f = eval("document." + form_id);
//field = eval("document." + form_id + "." + name_field);
field = eval("document." + form_id + ".elements['"+ name_field +"']");
field_all = eval("document." + form_id + "." + name_field_all);
if(field.length == undefined){
if(field.checked == false){
field_all.checked = false;
}
}else{
for (w=0; w < field.length; w++) {
if(field[w].checked == false){
field_all.checked = false;
}
}
}
}
/*Check all check box*/
/*Create object from type to*/
function get_combo_group_list_submit(form_id, layer_id, id, obj){
var post_json = new Object;
post_json["public"] = false;
post = false;
f = eval("document." + form_id);
/*if(f.public.checked == true){
post = true;
}else{
document.getElementById(layer_id).innerHTML = "";
post = false;
}*/
if(obj.checked == true){
post = true;
post_json[obj.name] = true;
document.getElementById(layer_id).innerHTML = " ";
}else{
post = false;
document.getElementById(layer_id).innerHTML = "";
}
if(post){
document.getElementById("empty_box_" + id).innerHTML = "";
document.getElementById("div_rem_" + id).style.height = 100;
text_json = JSON.stringify(post_json);
document.getElementById("span_box_account_" + id).style.display = "";
//x_get_email_list_group_submit(text_json, layer_id, id, form_id, call_back_ajax);
x_get_email_list_group_submit(text_json, layer_id, id, form_id, generate_group_table);
}else{
document.getElementById("div_rem_" + id).style.height = 25;
document.getElementById("empty_box_" + id).innerHTML = "Selecione os destinatários";
document.getElementById("span_box_account_" + id).style.display = "none";
}
}
/*Create object from type to*/
function checkShowLayer(obj, layer_id){
if(obj.checked == true){
document.getElementById(layer_id).style.display = "";
}else{
document.getElementById(layer_id).style.display = "none";
}
}
//---------------------------------------------------------------------------------------
function close_quick_insert_user(){
p = confirm("Deseja fechar sem salvar?");
if(p){
document.getElementById("quick_insert").innerHTML = "";
document.getElementById("quick_insert").style.display = "none";
}
}
//---------------------------------------------------------------------------------------
function close_quick_insert_client(){
p = confirm("Deseja fechar sem salvar?");
if(p){
document.getElementById("quick_insert").innerHTML = "";
document.getElementById("quick_insert").style.display = "none";
}
}
//---------------------------------------------------------------------------------------
function add_proc_user_ajax_cb(obj_json) {
//alert(obj_json);
var arr_get = JSON.parse(obj_json);
from = arr_get["from"];
if(arr_get["errors"] != false){
document.getElementById("errors_quick_insert").innerHTML = arr_get["errors"];
}else{
document.getElementById("quick_insert").innerHTML = "
Usuário adicionado com sucesso. ";
setTimeout('close_quick_insert()',2000);
if(from == "left_menu"){
}
if(from == "home"){
}
if(from == "task"){
layer = "task_share_"+arr_get["id_item"];
x_get_form_share_task(arr_get["id_item"], layer, call_back_ajax);
}
if(from == "task_update"){
layer = "task_share_"+arr_get["id_item"];
x_get_form_share_task_update(arr_get["id_item"], layer, call_back_ajax);
}
if(from == "notepad"){
x_get_form_share_notepad("div_share_notepad_0", generate_group_table);
//x_get_form_share_notepad("div_share_notepad_0", call_back_ajax);
}
if(from == "notepad_update"){
layer = "div_share_notepad_"+arr_get["id_item"];
//x_get_form_share_notepad_update(arr_get["id_item"], layer, call_back_ajax);
x_get_form_share_notepad_update(arr_get["id_item"], layer, generate_group_table);
}
if(from == "virtual_disc"){
x_get_form_share_virtual_disc("div_share_virtual_disc_0", call_back_ajax);
}
if(from == "virtual_disc_update"){
layer = "div_share_virtual_disc_"+arr_get["id_item"];
x_get_form_share_virtual_disc_update(arr_get["id_item"], layer, call_back_ajax);
}
if(from == "schedule"){
layer = "div_share_schedule_"+arr_get["id_item"];
//x_get_form_share_schedule(arr_get["id_item"], layer, call_back_ajax);
x_get_form_share_schedule(arr_get["id_item"], layer, generate_group_table);
}
if(from == "schedule_update"){
layer = "div_share_schedule_"+arr_get["id_item"];
//x_get_form_share_schedule_update(arr_get["id_item"], layer, call_back_ajax);
x_get_form_share_schedule_update(arr_get["id_item"], layer, generate_group_table);
}
}
}
//---------------------------------------------------------------------------------------
function add_proc_client_ajax_cb(obj_json) {
//alert(obj_json);
var arr_get = JSON.parse(obj_json);
from = arr_get["from"];
if(arr_get["errors"] != false){
document.getElementById("errors_quick_insert").innerHTML = arr_get["errors"];
}else{
document.getElementById("quick_insert").innerHTML = "
Cliente adicionado com sucesso. ";
setTimeout('close_quick_insert()',2000);
if(from == "home"){
}
if(from == "left_menu"){
}
if(from == "virtual_disc"){
x_get_form_clients_virtual_disc("div_clients_virtual_disc_0", call_back_ajax);
}
if(from == "virtual_disc_update"){
layer = "div_clients_virtual_disc_"+arr_get["id_item"];
x_get_form_clients_virtual_disc_update(arr_get["id_item"], layer, call_back_ajax);
}
if(from == "task"){
x_get_form_clients_task("task_clients_0", call_back_ajax);
}
if(from == "task_update"){
layer = "task_clients_"+arr_get["id_item"];
x_get_form_clients_task_update(arr_get["id_item"], layer, call_back_ajax);
}
}
}
function check_img_thumb(td_id, id){
total_td = document.getElementById("count_img_" + id).value;
for(i=0; i < total_td ; i++){
document.getElementById("img_thumb_" + id + "_" + i).border = "";
}
if(td_id){
document.getElementById(td_id).border = "2px";
}
}
var firefox = document.getElementById&&!document.all;
function quick_insert(objHelp) {
objHelp.onmousedown = function (e) {
if (firefox) {
screenY_help = window.outerHeight;
screenX_help = window.outerWidth;
scrollY_help = window.pageYOffset;
x_help = e.clientX;
y_help = e.clientY;
} else {
screenY_help = document.body.offsetHeight;
screenX_help = document.body.offsetWidth;
scrollY_help = document.body.scrollTop;
x_help = event.clientX;
y_help = event.clientY;
}
var menu = document.getElementById(objHelp.attributes["target_help"].value);
if (menu) {
menuWidth_help = parseFloat(menu.style.width.replace("px", ""));
menuHeight_help = parseFloat(menu.style.height.replace("px", ""));
newX_help = x_help + 50
newY_help = (y_help - 10) + scrollY_help;
if ((menuWidth_help + newX_help) > screenX_help) {
newX_help = x_help - (menuWidth_help + 50);
}
if ((((menuHeight_help + newY_help) - scrollY_help) + 150) > screenY_help) {
newY_help = y_help - (menuHeight_help - scrollY_help);
}
if (!menu.style.left.indexOf('-')) {
newX_help = 0;
}
if (!menu.style.top.indexOf('-')) {
newY_help = 0;
}
menu.style.left = newX_help;
menu.style.top = newY_help;
//alert(objHelp.attributes["which_help"].value);
menu.style.display = '';
if(objHelp.attributes["which_help"].value == "user"){
from_help = objHelp.attributes["from"].value;
if(objHelp.attributes["id_item"].value){
id_item_help = objHelp.attributes["id_item"].value;
}else{
id_item_help = "";
}
x_add_user_ajax(from_help, id_item_help, call_back_ajax);
}else if(objHelp.attributes["which_help"].value == "client"){
from_help = objHelp.attributes["from"].value;
if(objHelp.attributes["id_item"].value){
id_item_help = objHelp.attributes["id_item"].value;
}else{
id_item_help = "";
}
x_add_client_ajax(from_help, id_item_help, call_back_ajax);
}
}
};
}
function close_quick_insert(){
document.getElementById("quick_insert").innerHTML = "";
document.getElementById("quick_insert").style.display = "none";
}
function close_news(id_news){
document.getElementById("news_"+id_news).innerHTML = "";
x_close_news_ajax(id_news, close_news_ajax_cb);
}
function close_news_ajax_cb(){
}
function update_last_logout_cb(){
}
function open_calculator_ajax_cb(obj_json){
//alert(obj_json);
var arr_get = JSON.parse(obj_json);
document.getElementById(arr_get["layer_id"]).innerHTML = arr_get["text_return"];
centralize(arr_get["layer_id"])
showLayer(arr_get["layer_id"]);
}
function close_calculator(layer_id){
document.getElementById(layer_id).innerHTML = "";
showLayer(layer_id);
}
function quick_note_ajax_cb(obj_json){
//alert(obj_json);
var arr_get = JSON.parse(obj_json);
document.getElementById(arr_get["layer_id"]).innerHTML = arr_get["text_return"];
centralize(arr_get["layer_id"])
showLayer(arr_get["layer_id"]);
}
function close_quick_note(layer_id){
document.getElementById(layer_id).innerHTML = "";
showLayer(layer_id);
}
function quick_note_proc_ajax_cb(obj_json) {
alert(obj_json) ;
var arr_get = JSON.parse(obj_json);
if(arr_get["text_return"] == false){
document.getElementById("errors_notepad_0").innerHTML = arr_get["errors"];
}else{
document.getElementById("ok_quick_note").innerHTML = " ";
setTimeout("close_quick_note('div_quick_note');", 2000);
}
}
function rough_draft_ajax_cb(obj_json){
//alert(obj_json);
var arr_get = JSON.parse(obj_json);
document.getElementById(arr_get["layer_id"]).innerHTML = arr_get["text_return"];
centralize(arr_get["layer_id"])
showLayer(arr_get["layer_id"]);
}
function close_rough_draft(){
layer_id = "div_rough_draft";
document.getElementById(layer_id).innerHTML = "";
showLayer(layer_id);
}
function rough_draft_proc_ajax_cb(obj_json) {
//alert(obj_json) ;
var arr_get = JSON.parse(obj_json);
if(arr_get["text_return"] == false){
document.getElementById("errors_rough_draft_0").innerHTML = arr_get["errors"];
}else{
close_rough_draft();
}
}
function setTimeoutHome(){
setTimeout("window.location = 'home.php';",5000);
}
function re_send_billing_ajax_cb(list){
//alert(list);
if(list == true){
document.getElementById("div_re_send_billing").innerHTML = "Cobrança reenviada com sucesso! ";
}else{
document.getElementById("div_re_send_billing").innerHTML = "Falha no reenvio da cobrança, tente mais tarde. ";
}
}
function getPaymentForm(list){
switch(list){
case "0":
document.getElementById("img_cc").src = "img/0CodSegurancaAmex.gif";
payment_type = "cc";
break;
case "34":
case "3":
case "31":
document.getElementById("img_cc").src = "img/0CodSeguranca.gif";
payment_type = "cc";
break;
case "36":
payment_type = "boleto";
break;
case "7":
case "32":
case "26":
payment_type = "debito";
break;
default:
payment_type = "";
break;
}
if(payment_type == "cc"){
if(document.getElementById("cc_div").style.display == "none"){
showHideLayer("cc_div", "boleto_div,debito_div");
}
document.getElementById("cc_security_code").className = "textfieldReq";
document.getElementById("cc_expiration_date").className = "textfieldReq";
document.getElementById("cc_number").className = "textfieldReq";
document.getElementById("dp_agency").className = "textfield";
document.getElementById("dp_agency_check_digit").className = "textfield";
document.getElementById("dp_account_number").className = "textfield";
document.getElementById("dp_account_check_digit").className = "textfield";
}else if(payment_type == "boleto"){
if(document.getElementById("boleto_div").style.display == "none"){
showHideLayer("boleto_div", "debito_div,cc_div");
}
document.getElementById("cc_security_code").className = "textfield";
document.getElementById("cc_expiration_date").className = "textfield";
document.getElementById("cc_number").className = "textfield";
document.getElementById("dp_agency").className = "textfield";
document.getElementById("dp_agency_check_digit").className = "textfield";
document.getElementById("dp_account_number").className = "textfield";
document.getElementById("dp_account_check_digit").className = "textfield";
}else if(payment_type == "debito"){
if(document.getElementById("debito_div").style.display == "none"){
showHideLayer("debito_div", "cc_div,boleto_div");
}
document.getElementById("cc_security_code").className = "textfield";
document.getElementById("cc_expiration_date").className = "textfield";
document.getElementById("cc_number").className = "textfield";
document.getElementById("dp_agency").className = "textfieldReq";
document.getElementById("dp_agency_check_digit").className = "textfieldReq";
document.getElementById("dp_account_number").className = "textfieldReq";
document.getElementById("dp_account_check_digit").className = "textfieldReq";
}else{
document.getElementById("cc_div").style.display = "none";
document.getElementById("boleto_div").style.display = "none";
document.getElementById("debito_div").style.display = "none";
}
}
function getPaymentFormUpdate(list){
switch(list){
case "0":
document.getElementById("img_cc").src = "img/0CodSegurancaAmex.gif";
payment_type = "cc";
break;
case "34":
case "3":
case "31":
document.getElementById("img_cc").src = "img/0CodSeguranca.gif";
payment_type = "cc";
break;
case "36":
payment_type = "boleto";
break;
case "7":
case "26":
case "32":
payment_type = "debito";
break;
default:
payment_type = "";
break;
}
if(payment_type == "cc"){
document.getElementById("boleto_div").style.display = "none";
document.getElementById("debito_div").style.display = "none";
document.getElementById("cc_div").style.display = "";
document.getElementById("default_div").style.display = "";
document.getElementById("button_div").style.display = "";
document.getElementById("cc_security_code").className = "textfieldReq";
document.getElementById("cc_expiration_date").className = "textfieldReq";
document.getElementById("cc_number").className = "textfieldReq";
document.getElementById("dp_agency").className = "textfield";
document.getElementById("dp_agency_check_digit").className = "textfield";
document.getElementById("dp_account_number").className = "textfield";
document.getElementById("dp_account_check_digit").className = "textfield";
}else if(payment_type == "boleto"){
document.getElementById("boleto_div").style.display = "";
document.getElementById("debito_div").style.display = "none";
document.getElementById("cc_div").style.display = "none";
document.getElementById("default_div").style.display = "";
document.getElementById("button_div").style.display = "";
document.getElementById("cc_security_code").className = "textfield";
document.getElementById("cc_expiration_date").className = "textfield";
document.getElementById("cc_number").className = "textfield";
document.getElementById("dp_agency").className = "textfield";
document.getElementById("dp_agency_check_digit").className = "textfield";
document.getElementById("dp_account_number").className = "textfield";
document.getElementById("dp_account_check_digit").className = "textfield";
}else if(payment_type == "debito"){
document.getElementById("boleto_div").style.display = "none";
document.getElementById("debito_div").style.display = "";
document.getElementById("cc_div").style.display = "none";
document.getElementById("default_div").style.display = "";
document.getElementById("button_div").style.display = "";
}else{
document.getElementById("cc_div").style.display = "none";
document.getElementById("boleto_div").style.display = "none";
document.getElementById("debito_div").style.display = "none";
document.getElementById("cc_security_code").className = "textfield";
document.getElementById("cc_expiration_date").className = "textfield";
document.getElementById("cc_number").className = "textfield";
document.getElementById("dp_agency").className = "textfieldReq";
document.getElementById("dp_agency_check_digit").className = "textfieldReq";
document.getElementById("dp_account_number").className = "textfieldReq";
document.getElementById("dp_account_check_digit").className = "textfieldReq";
}
}
function getPaymentFormUpdateAdmin(list){
switch(list){
case "0":
document.getElementById("img_cc").src = "img/0CodSegurancaAmex.gif";
payment_type = "cc";
break;
case "34":
case "3":
case "31":
document.getElementById("img_cc").src = "img/0CodSeguranca.gif";
payment_type = "cc";
break;
case "36":
payment_type = "boleto";
break;
case "7":
case "26":
case "32":
payment_type = "debito";
break;
default:
payment_type = "";
break;
}
if(payment_type == "cc"){
document.getElementById("boleto_div").style.display = "none";
document.getElementById("debito_div").style.display = "none";
document.getElementById("cc_div").style.display = "";
document.getElementById("default_div").style.display = "";
document.getElementById("button_div").style.display = "";
document.getElementById("cc_security_code").className = "textfieldReq";
document.getElementById("cc_expiration_date").className = "textfieldReq";
document.getElementById("cc_number").className = "textfieldReq";
document.getElementById("dp_agency").className = "textfield";
document.getElementById("dp_agency_check_digit").className = "textfield";
document.getElementById("dp_account_number").className = "textfield";
document.getElementById("dp_account_check_digit").className = "textfield";
}else if(payment_type == "boleto"){
document.getElementById("boleto_div").style.display = "";
document.getElementById("debito_div").style.display = "none";
document.getElementById("cc_div").style.display = "none";
document.getElementById("default_div").style.display = "none";
document.getElementById("button_div").style.display = "none";
document.getElementById("cc_security_code").className = "textfield";
document.getElementById("cc_expiration_date").className = "textfield";
document.getElementById("cc_number").className = "textfield";
document.getElementById("dp_agency").className = "textfield";
document.getElementById("dp_agency_check_digit").className = "textfield";
document.getElementById("dp_account_number").className = "textfield";
document.getElementById("dp_account_check_digit").className = "textfield";
}else if(payment_type == "debito"){
document.getElementById("boleto_div").style.display = "none";
document.getElementById("debito_div").style.display = "";
document.getElementById("cc_div").style.display = "none";
document.getElementById("default_div").style.display = "";
document.getElementById("button_div").style.display = "";
document.getElementById("cc_security_code").className = "textfield";
document.getElementById("cc_expiration_date").className = "textfield";
document.getElementById("cc_number").className = "textfield";
document.getElementById("dp_agency").className = "textfieldReq";
document.getElementById("dp_agency_check_digit").className = "textfieldReq";
document.getElementById("dp_account_number").className = "textfieldReq";
document.getElementById("dp_account_check_digit").className = "textfieldReq";
}else{
document.getElementById("cc_div").style.display = "none";
document.getElementById("boleto_div").style.display = "none";
document.getElementById("debito_div").style.display = "none";
}
}
function get_table_from_cell_id(row_id){
table = document.getElementById(row_id).parentNode.parentNode;
return table;
}
function get_table_from_row_id(row_id){
table = document.getElementById(row_id).parentNode;
return table;
}
function delete_row_from_cell_id(row_id){
id_line = document.getElementById(row_id).parentNode.rowIndex;
table = get_table_from_cell_id(row_id);
table.deleteRow(id_line);
}
function delete_row_from_row_id(row_id){
id_line = document.getElementById(row_id).rowIndex;
table = get_table_from_row_id(row_id);
table.deleteRow(id_line);
}
function recolorize_rows(table, class_on, class_off, no_rows_msg){
total_lines = table.rows.length;
if(total_lines == 0){
row = table.insertRow(0);
cell = row.insertCell(0);
cell.innerHTML = no_rows_msg;
}else{
for(x=0;x < total_lines; x++){
if((x%2) == 0){
table.rows[x].className = class_on;
}else{
table.rows[x].className = class_off;
}
}
}
}
function get_chat_status_cb(html){
if (html != "")
{
//document.getElementById("div_chat").innerHTML = "online";
document.getElementById("div_chat").innerHTML = " ";
}
else
{
document.getElementById("div_chat").innerHTML = "";
}
}
function timeout_chat(){
x_get_chat_status(get_chat_status_cb);
setTimeout("timeout_chat();", (60000*5));
}
/*Create object from type to*/
function get_combo_client_list(form_id, layer_id, id, obj){
var post_json = new Object;
post_json["public"] = false;
post = false;
f = eval("document." + form_id);
/*if(f.public.checked == true){
post = true;
}else{
document.getElementById(layer_id).innerHTML = "";
post = false;
}*/
if(obj.checked == true){
post = true;
post_json[obj.name] = true;
document.getElementById(layer_id).innerHTML = " ";
}else{
post = false;
document.getElementById(layer_id).innerHTML = "";
}
if(post){
document.getElementById("empty_box_clients_" + id).innerHTML = "";
document.getElementById("div_rem_clients_" + id).style.height = 100;
text_json = JSON.stringify(post_json);
document.getElementById("span_box_clients_" + id).style.display = "";
x_get_email_list_client(text_json, layer_id, id, form_id, generate_client_table);
}else{
document.getElementById("div_rem_clients_" + id).style.height = 25;
document.getElementById("empty_box_clients_" + id).innerHTML = "Selecione os destinatários";
document.getElementById("span_box_clients_" + id).style.display = "none";
}
}
function modify_onclick(obj, type_obj, onclick_action){
if(type_obj == "item_id"){
obj = document.getElementById(obj);
}
obj.onclick = function onclick(event) { eval(onclick_action); };
}
/*Create object from type to*/
function generate_group_table(obj_json){
var arr_get = JSON.parse(obj_json);
layer_account = arr_get["layer_account"];
layer_id = arr_get["layer_id"];
table_id = arr_get["table_id"];
arr_lines = arr_get["arr_lines"];
table_content = arr_get["table_content"];
text_return = arr_get["text_return"];
document.getElementById(layer_id).innerHTML = text_return;
total_lines = arr_lines.length;
if(total_lines > 0){
document.getElementById(layer_account).innerHTML = "";
table = document.getElementById(table_id);
for(x=0;x < total_lines;x++){
row = table.insertRow(x);
cell = row.insertCell(0);
arr_line = arr_lines[x].split("|##|");
line = ""+ arr_line[3] +" ";
cell.innerHTML = line;
}
}
}
function generate_client_table(obj_json){
var arr_get = JSON.parse(obj_json);
layer_account = arr_get["layer_account"];
layer_id = arr_get["layer_id"];
table_id = arr_get["table_id"];
arr_lines = arr_get["arr_lines"];
table_content = arr_get["table_content"];
text_return = arr_get["text_return"];
document.getElementById(layer_id).innerHTML = text_return;
total_lines = arr_lines.length;
if(total_lines > 0){
document.getElementById(layer_account).innerHTML = "";
table = document.getElementById(table_id);
for(x=0;x < total_lines;x++){
row = table.insertRow(x);
cell = row.insertCell(0);
arr_line = arr_lines[x].split("|##|");
line = ""+ arr_line[3] +" ";
cell.innerHTML = line;
}
}
}
function remove_cell_id(cell_id){
delete_row_from_cell_id(cell_id);
}
/**
Função que move uma tr de uma tabela para outra
Params (obj_td, tabela1, tabela2)
**/
function move_cell(obj, table1, table2){
var row = obj.parentNode;
var cell = obj;
var table = row.parentNode;
var table_id = obj.parentNode.parentNode.parentNode.id;
var row_index = row.rowIndex;
if(table1 == table_id){
new_table = document.getElementById(table2);
}else{
new_table = document.getElementById(table1);
}
var new_row = new_table.insertRow(new_table.rows.length);
var new_cell = new_row.insertCell(-1);
new_cell.innerHTML = cell.innerHTML;
table.deleteRow(row_index);
}
function remove_all_rows(table){
obj_table = document.getElementById(table);
while(obj_table.rows.length > 0){
obj_table.deleteRow(0);
}
}
function showBoletoNotify(type_payment, tp_module){
if(type_payment == '36' && tp_module == 'email_marketing'){
document.getElementById('boletomsg').style.display = '';
}else{
document.getElementById('boletomsg').style.display = 'none';
}
}
function power_validate(){
}
function validate_buy_form(form_name, layer_errors){
f = eval("document."+form_name);
payment_type = f.payment_type.value;
errors = "";
if(payment_type == "99999"){
// selecione
errors += "Escolha a forma de pagamento. ";
}else{
if(!f.billing_name.value){
errors += "O campo Nome do Usuário/Empresa à ser cobrado é obrigatório. ";
}
if(!f.cpf_cnpj.value){
errors += "O campo CPF ou CNPJ é inválido. ";
}
if(!f.phone.value){
errors += "O campo telefone é obrigatório. ";
}else if(!f.phone_confirm.value){
errors += "O campo confirmação de telefone é obrigatório. ";
}else if(f.phone_confirm.value != f.phone.value){
errors += "O campo telefone deve ser igual ao confirmação de telefone. ";
}
if(payment_type == "36"){
// boleto
if(!f.bo_address.value){
errors += "O campo endereço é obrigatório. ";
}
if(!f.bo_address_number.value){
errors += "O campo número é obrigatório. ";
}
if(!f.bo_city.value){
errors += "O campo cidade é obrigatório. ";
}
if(!f.zip_code.value){
errors += "- O campo cep é obrigatório.";
}
}else if(payment_type == "0" || payment_type == "34" || payment_type == "3"){
// cartão
if(!f.cc_number.value){
errors += "O campo número do cartão de crédito é obrigatório ";
}
if(!f.cc_security_code.value){
errors += "O campo código de segurança é obrigatório ";
}
if(!f.cc_expiration_date.value){
errors += "O campo data de expiração é obrigatório. ";
}
}
if(!f.checkcontract.checked){
errors += "Você não aceitou o contrato de uso ";
}
}
if(errors.length > 0){
erros = "";
erros += "
Verifique os erros abaixo: " + errors + "";
document.getElementById(layer_errors).innerHTML = erros;
}else{
f.submit();
}
}
var $mf_limit;
var $mf_offset;
var $mf_layer_id;
function set_mf_offset(mf_offset) {
$mf_offset = mf_offset;
}
function set_mf_limit(mf_limit) {
$mf_limit = mf_limit;
}
function set_mf_layer_id(mf_layer_id) {
$mf_layer_id = mf_layer_id;
}
function load_mini_feed(){
document.getElementById("mini_feed_list").innerHTML = " ";
x_get_mini_feed_ajax($mf_limit, $mf_offset, $mf_layer_id, get_mini_feed_ajax_cb);
}
function get_mini_feed_ajax_cb(obj_json){
var arr_get = JSON.parse(obj_json);
document.getElementById(arr_get["layer_id"]).innerHTML = arr_get["text_return"];
}
function keep_loading_mini_feed(){
load_mini_feed();
//setTimeout("keep_loading_mini_feed();", 30000);
}