var req = null; var reqTarget = null; function _$(e){return (document.getElementById(e)) ? document.getElementById(e) : null;} function showAMCNews(f){ showLightbox('modalBox'); __initRequest(); reqTarget = 'modalContent'; post = "fn="+trim12(f); req.doPost('/AMCBackHandler.html?cleanResponse=1&jxid=9',post,__showResponse); } function paginationAction(ofs){ f = document.forms['paginationf']; _$('poffset').value = ofs; f.submit(); } function viewPartnerDetails(ch, partner_id, dist_id){ showLightbox('modalBox'); __initRequest(); reqTarget = 'modalContent'; post = "bc=0&ch="+ch+"&partner_id="+partner_id+"&dist_id="+dist_id; req.doPost('/AMCBackHandler.html?cleanResponse=1&jxid=1',post,__showResponse); } function viewCustomerDetails(cid,pid){ showLightbox('modalBox'); __initRequest(); reqTarget = 'modalContent'; post = "cid="+cid+"&pid="+pid; req.doPost('/AMCBackHandler.html?cleanResponse=1&jxid=3',post,__showResponse); } function viewUsersList(partner_id){ showLightbox('modalBox'); __initRequest(); reqTarget = 'modalContent'; req.doGet('/AMCBackHandler.html?cleanResponse=1&jxid=100&bc=0&partner_id='+partner_id,__showResponse); } function viewUserInfo(user_id){ showLightbox('modalBox'); __initRequest(); reqTarget = 'modalContent'; req.doGet('/AMCBackHandler.html?cleanResponse=1&jxid=103&bc=0&user_id='+user_id,__showResponse); } function getListOfARIDS(cust_id){ showLightbox('modalBox'); __initRequest(); reqTarget = 'modalContent'; arid = trim12(_$('arid').value); arc_pcat = trim12(_$('arc_pcat').value); arc_desc = trim12(_$('arc_desc').value); arc_hid = trim12(_$('arc_hid').value); rec_status = trim12(_$('act_rec').value); post = "bc=0&customer_id="+cust_id if (arid.length > 0){post += "&arid="+arid;} if (arc_pcat.length > 0){post += "&arc_pcat="+arc_pcat;} if (arc_desc.length > 0){post += "&arc_desc="+arc_desc;} if (arc_hid.length > 0){post += "&arc_hid="+arc_hid;} if (rec_status.length > 0){post += "&act_rec="+rec_status;} req.doPost('/AMCBackHandler.html?cleanResponse=1&jxid=2',post,__showResponse); } function getListOfSWAARIDS(cust_id, quote_num){ showLightbox('modalBox'); __initRequest(); reqTarget = 'modalContent'; post = "bc=0&customer_id="+cust_id+""e_num="+quote_num; req.doPost('/AMCBackHandler.html?cleanResponse=1&jxid=4',post,__showResponse); } function getListOfARIDSShared(cust_id,searcht){ showLightbox('modalBox'); __initRequest(); reqTarget = 'modalContent'; arc_ident = trim12(_$('arc_ident').value); arc_desc = trim12(_$('arc_desc').value); arc_pcat = trim12(_$('arc_pcat').value); arc_hid = trim12(_$('arc_hid').value); act_rec = trim12(_$('act_rec').value); post = "bc=0&customer_id="+cust_id if (arc_ident.length > 0){post += "&arc_ident="+arc_ident;} if (arc_desc.length > 0){post += "&arc_desc="+arc_desc;} if (arc_pcat.length > 0){post += "&arc_pcat="+arc_pcat;} if (arc_hid.length > 0){post += "&arc_hid="+arc_hid;} if (act_rec.length > 0){post += "&act_rec="+act_rec;} req.doPost('/AMCBackHandler.html?cleanResponse=1&jxid='+searcht,post,__showResponse); } function showOrderDetails(o,r){ showLightbox('modalBox'); __initRequest(); reqTarget = 'modalContent'; lb_pnum = trim12(_$('partno').value); lb_pcat = trim12(_$('productcategory').value); lb_paid = trim12(_$('partner_id').value); lb_diid = trim12(_$('distributor_id').value); post = "oid="+o; post += "&ptype="+r; if (lb_pnum.length > 0){post += "&lb_pnum="+lb_pnum;} if (lb_pcat.length > 0){post += "&lb_pcat="+lb_pcat;} if (lb_paid.length > 0){post += "&partner_id="+lb_paid;} if (lb_diid.length > 0){post += "&distributor_id="+lb_diid;} req.doPost('/AMCBackHandler.html?cleanResponse=1&jxid=7',post,__showResponse); } function showOrderDetailsAssign(o,r){ showLightbox('modalBox'); __initRequest(); reqTarget = 'modalContent'; lb_pnum = trim12(_$('partno').value); lb_pcat = trim12(_$('productcategory').value); lb_paid = trim12(_$('partner_id').value); lb_diid = trim12(_$('distributor_id').value); lb_srid = trim12(_$('server_id').value); post = "oid="+o; post += "&ptype="+r; if (lb_pnum.length > 0){post += "&lb_pnum="+lb_pnum;} if (lb_pcat.length > 0){post += "&lb_pcat="+lb_pcat;} if (lb_paid.length > 0){post += "&partner_id="+lb_paid;} if (lb_diid.length > 0){post += "&distributor_id="+lb_diid;} if (lb_srid.length > 0){post += "&server_id="+lb_srid;} req.doPost('/AMCBackHandler.html?cleanResponse=1&jxid=8',post,__showResponse); } function showOrdersWithBundle(bundle, partno_ref, r) { showLightbox('modalBox'); __initRequest(); reqTarget = 'modalContent'; lb_paid = trim12(_$('partner_id').value); lb_diid = trim12(_$('distributor_id').value); post = "bundle="+bundle; post += "&partno_ref="+partno_ref; post += "&ptype="+r; if (lb_paid.length > 0){post += "&partner_id="+lb_paid;} if (lb_diid.length > 0){post += "&distributor_id="+lb_diid;} req.doPost('/AMCBackHandler.html?cleanResponse=1&jxid=10',post,__showResponse); } // function createCustomer(){ u = _$('uname').value; showLightbox('modalBox'); __initRequest(); reqTarget = 'modalContent'; req.doGet('/AMCBackHandler.html?cleanResponse=1&jxid=3&bc=0&wsid='+u,__showResponse); } function _createCustomer(res){ } function createPartner(){ u = "Create Partner"; showLightbox('modalBox'); __initRequest(); reqTarget = 'modalContent'; req.doGet('/AMCBackHandler.html?cleanResponse=1&jxid=2&bc=0&wsid='+u,__showResponse) } function _$(e){return document.getElementById(e);} function getKeyPressed(e){ if (window.event){ return e.keyCode; }else{ return e.which; } } function valNumber(evt){ chCode = getKeyPressed(evt); if (chCode != 46 && chCode > 31 && (chCode < 48 || chCode > 57)){ return false; } return true; } function trim12(str) { var str = str.replace(/^\s\s*/, ''), ws = /\s/, i = str.length; while (ws.test(str.charAt(--i))); res = str.slice(0, i + 1); str_a = res.split(/\s/); x = ""; for(i=0; i i){res = res.substring((i+8),j);} window.submitted = 0; __shProgress(false,""); /* // ITA001182 - No error handling. if (res.indexOf('0x') != -1){ __handleErrors(res); }else{ _$(reqTarget).innerHTML = res; } */ _$(reqTarget).innerHTML = res; } function __handleErrors(err){ _err = ""; is_error = 1; switch (err){ case "0x02INSERR" : _err = "An error ocurred while trying to save the data. Data not saved"; break; case "0x02FUPERR" : _err = "Follow up information could not be saved."; break; case "0x03ADMERR" : _err = "User not authorized to perform this operation"; break; case "0x03INSERR" : _err = "An error ocurred while trying to save the user. User not saved"; break; default : is_error = 0; } if( is_error == 1 ){ alert(_err); }else{ _$(reqTarget).innerHTML = err; } } function __initRequest(){ req = null; req = new AE_Ajax(); } function __shProgress(b,lt){ inProgress = b; ws = getPageSize(); //_$('LoaderInd').style.display = b ? 'block' : 'none'; }