function showcollapse(what){
a=document.getElementById(what)
if (a.style.display==''){
a.style.display='none';
} else {
a.style.display='';
a.focus();
}
}
function checkrecievedvalue(element)
{
if (document.getElementById(element).value < 5)
{
document.getElementById(element).value = 5;
}
}
function cancelsubmit(msg,element){
alert(msg);
document.getElementById(element).focus();
return false
}
function isNumeric(what){
if (what.search(/^[-+]?\d+(\.\d+)?$/) != -1)
return true;
else
return false;
}
function isInteger(what){
if (what.search(/^[-+]?[1-9]\d*.?[0]*$/) != -1)
return true;
else
return false;
}
function isEmail(what) {
// Works
if (what.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
return true;
else
return false;
}
function isAlphanumeric(what){
// ANY alphanumeric string with spaces, commas, dashes.
if (what.search(/^[a-zA-Z0-9\s.\-]+$/) != -1)
return true;
else
return false;
}
function isAlphabetic(what){
if (what.search(/^[a-zA-Z\s]+$/) != -1)
return true;
else
return false;
}
function noSpaces(what){
if (what.search(/\s/) != -1)
return false;
else
return true;
}
function isCC(what){
if (what.search(/^((4\d{3})|(5[1-5]\d{2})|(6011))-?\d{4}-?\d{4}-?\d{4}|3[4,7]\d{13}$/) != -1)
return true;
else
return false;
}
function _trim(value){
return value.replace(/^\s+|\s+$/g, '');
}
function wwsAFPget(what){
return(document.getElementById(what));
}
function wwsAFPexists(what){
if (document.getElementById(what))
return true;
else
return false;
}//Ajax starting from here
function viewRefTicket(rtcid){
document.getElementById('ajaxBlock').innerHTML = '
Loading...
';
loadFragmentInToElement('../../../client/viewrefticket.php?rtcid='+rtcid,'ajaxBlock','');
}
function replyRefTicket(){
if (wwsAFPexists('Your Question')){
if (wwsAFPget('Your Question').value==''){return cancelsubmit('Field \'Your Question\' is required','Your Question')}
}
document.getElementById('formName').submit();
loadFragmentInToElement('../../../client/referralpoints.php','ajaxBlock','We have successfully saved reply ticket.');
}
function referralOrder(ltid,qty,points){
var flag = confirm('You have chosen to redeem active Referral Points for the selected item. Select OK to confirm, or Cancel if you do not wish to redeem now.');
if(flag){
var params = 'ltid='+ltid+'&qty='+qty+'&points='+points;
document.getElementById('Process'+ltid).innerHTML = 'Saving....';
savePostData('../../../client/savereferalorder.php',params);
setTimeout('referralPoints()',1500);
}
}
function referralNAOrder(){
alert('Notice: you do not have enough active Referral Points to redeem for this item.');
}
function saveCashPayment(cash){
var flag = confirm('You have chosen to redeem active Referral Points for the selected item. Select OK to confirm, or Cancel if you do not wish to redeem now.');
if(flag){
var params = 'cash='+cash;
document.getElementById('Process'+cash).innerHTML = 'Saving....';
savePostData('../../../client/savereferal.php',params);
setTimeout('referralPoints()',1500);
}
}
function storePage(pgid){
document.getElementById('ajaxBlock').innerHTML = '
Loading...
';
loadFragmentInToElement('../../../client/storepage.php?pgid='+pgid,'ajaxBlock','');
}
function clientForgot(){
document.getElementById('ajaxBlock').innerHTML = '
Loading...
';
loadFragmentInToElement('../../../client/clientforgot.php','ajaxBlock','');
}
function sentPassword(){
if (wwsAFPexists('Email ID')){
if (wwsAFPget('Email ID').value==''){return cancelsubmit('Field \'Email ID\' is required','Email ID')}
if (!isEmail(wwsAFPget('Email ID').value)){return cancelsubmit('Field \'Email ID\' does not contain a valid e-mail address.','Email ID')}
}
document.getElementById('Action').value = 'forgotpassword';
document.getElementById('formName').submit();
window.document.location.href = 'index.php?page=login';
}
function clientLogin(maid){
document.getElementById('ajaxBlock').innerHTML = '
Loading...
';
loadFragmentInToElement('../../../client/clientlogin.php?maid='+maid,'ajaxBlock','');
}
function checkUnicode(e){
var unicode=e.keyCode? e.keyCode : e.charCode
if(unicode == 13) loginCheck();
}
function loginCheck(){
if (wwsAFPexists('Username')){
if (wwsAFPget('Username').value==''){return cancelsubmit('Field \'E-Mail\' is required','Username')}
}
if (wwsAFPexists('Password')){
if (wwsAFPget('Password').value==''){return cancelsubmit('Field \'Password\' is required','Password')}
}
document.getElementById('Action').value = 'login';
document.getElementById('formName').submit();
window.document.location.href = 'index.php?page=login';
}
function showMyAccount(pgid){
document.getElementById('ajaxBlock').innerHTML = '
Loading...
';
loadFragmentInToElement('../../../client/home.php','ajaxBlock','');
}
function showOrders(){
document.getElementById('ajaxBlock').innerHTML = '
Loading...
';
loadFragmentInToElement('../../../client/showorders.php','ajaxBlock','');
}
function showCoOpOrders(){
document.getElementById('ajaxBlock').innerHTML = '
Loading...
';
loadFragmentInToElement('../../../client/showcooporders.php','ajaxBlock','');
}
function showGCOrders(){
document.getElementById('ajaxBlock').innerHTML = '
Loading...
';
loadFragmentInToElement('../../../client/showgcorders.php','ajaxBlock','');
}
function showInvoices(){
document.getElementById('ajaxBlock').innerHTML = '
Loading...
';
loadFragmentInToElement('../../../client/showpurchases.php','ajaxBlock','');
}
function printInvoice(puid){
window.open ('../../../client/printinvoice.php?puid='+puid, 'printwindow','width=500,height=450');
}
function showLeads(orid){
document.getElementById('ajaxBlock').innerHTML = '
Loading...
';
loadFragmentInToElement('../../../client/showleads.php?orid='+orid,'ajaxBlock','');
}
function searchLeads(linkFromViewLeadDetails)
{
if(linkFromViewLeadDetails)
{
var params = 'linkFromViewLeadDetails=1';
document.getElementById('ajaxBlock').innerHTML = '
';
loadFragmentInToElement('../../../client/searchleads.php','ajaxBlock','');
}
}
function searchLeadsWithPostData()
{
var firstname = document.getElementById('First Name').value;
var lastname = document.getElementById('Last Name').value;
var email = document.getElementById('Search Email').value;
var phonenumber = document.getElementById('Phone').value;
var ltid = document.getElementById('ltid').value;
var hidSearchLeads = document.getElementById('hidSearchLeads').value;
var params = 'hidSearchLeads='+hidSearchLeads+'&firstname='+firstname+'&lastname='+lastname+'&email='+email+'&phonenumber='+phonenumber+'<id='+ltid;
document.getElementById('ajaxBlock').innerHTML = '
Loading...
';
//savePostData('../../../client/searchleads.php',params);
//saveData('../../../client/searchleads.php?'+params);
loadFragmentInToElement('../../../client/searchleads.php?'+params,'ajaxBlock','');
}
function searchLeadsWithGetData(firstname, lastname, email, phonenumber, ltid, hidSearchLeads)
{
var params = 'hidSearchLeads='+hidSearchLeads+'&firstname='+firstname+'&lastname='+lastname+'&email='+email+'&phonenumber='+phonenumber+'<id='+ltid;
document.getElementById('ajaxBlock').innerHTML = '
Loading...
';
//savePostData('../../../client/searchleads.php',params);
//saveData('../../../client/searchleads.php?'+params);
loadFragmentInToElement('../../../client/searchleads.php?'+params,'ajaxBlock','');
}
function savePerdayLeads(orid){
if (wwsAFPexists('Per Day Leads')){
if (wwsAFPget('Per Day Leads').value==''){return cancelsubmit('Field \'Per Day Leads\' is required','Per Day Leads')}
}
leads = wwsAFPget('Per Day Leads').value;
saveData('../../../client/saveperdayleads.php?orid='+orid+'&leads='+leads);
document.getElementById('ajaxBlock').innerHTML = '
Loading...
';
loadFragmentInToElement('../../../client/showleads.php?orid='+orid,'ajaxBlock','');
}
function showAllLeads(){
document.getElementById('ajaxBlock').innerHTML = '
Loading...
';
loadFragmentInToElement('../../../client/showallleads.php','ajaxBlock','');
}
function showAutoShip(){
document.getElementById('ajaxBlock').innerHTML = '
Loading...
';
loadFragmentInToElement('../../../client/showautoship.php','ajaxBlock','');
}
function checkSubject(){
if (wwsAFPexists('Ticket Subject')){
if (wwsAFPget('Ticket Subject').value=='Other'){
document.getElementById('subject').innerHTML = ' ';
}else{
document.getElementById('subject').innerHTML = '';
}
}
}
function referralPoints(){
document.getElementById('ajaxBlock').innerHTML = '
Loading...
';
loadFragmentInToElement('../../../client/referralpoints.php','ajaxBlock','');
}
function referralFAQ(){
document.getElementById('ajaxBlock').innerHTML = '
Loading...
';
loadFragmentInToElement('../../../client/referralfaq.php','ajaxBlock','');
}
function showTicket(){
document.getElementById('ajaxBlock').innerHTML = '
Loading...
';
loadFragmentInToElement('../../../client/showtickets.php','ajaxBlock','');
}
function openNewTicket(){
document.getElementById('ajaxBlock').innerHTML = '
Loading...
';
loadFragmentInToElement('../../../client/opennewticket.php','ajaxBlock','');
}
function saveTicket(){
if (wwsAFPexists('Other Ticket Subject')){
if (wwsAFPget('Other Ticket Subject').value==''){return cancelsubmit('Field \'Other Ticket Subject\' is required','Other Ticket Subject')}
}
if (wwsAFPexists('Your Question')){
if (wwsAFPget('Your Question').value==''){return cancelsubmit('Field \'Your Question\' is required','Your Question')}
}
document.getElementById('formName').submit();
loadFragmentInToElement('../../../client/showtickets.php','ajaxBlock','We have successfully opened new ticket.');
}
function replyTicket(){
if (wwsAFPexists('Your Question')){
if (wwsAFPget('Your Question').value==''){return cancelsubmit('Field \'Your Question\' is required','Your Question')}
}
document.getElementById('formName').submit();
loadFragmentInToElement('../../../client/showtickets.php','ajaxBlock','We have successfully saved reply ticket.');
}
function downloadLeads(orid){
document.getElementById('Action').value='downloadleads';
document.getElementById('formName').submit();
}
function transferLeads(orid,maid){
if(maid==2)
var flag = confirm('Clicking the OK button will transfer all leads in this order to your active EarnPro account. Do you want to transfer these leads now?');
else
var flag = confirm('Are you sure you want to post these leads to your DFI LIVE account? All leads are automatically imported into DFI LIVE');
if(flag){
document.getElementById('Action').value='transferleads';
document.getElementById('formName').submit();
}
}
function transferLeads2(orid,maid){
if(maid==2)
var flag = confirm('Clicking the OK button will transfer all leads in this order to your active EarnPro account. Do you want to transfer these leads now?');
else if(maid==3)
var flag = confirm('Are you sure you want to post these leads to your DFI LIVE account? All leads are automatically imported into DFI LIVE');
else if(maid==10)
var flag = confirm('Are you sure you want to post these leads to your YourDestinyTeam account? All leads are automatically imported into YourDestinyTeam');
else if(maid==14)
var flag = confirm('Are you sure you want to post these leads to your OurSimpleWealth account? All leads are automatically imported into OurSimpleWealth');
if(flag){
document.getElementById('Action').value='transferleads2';
document.getElementById('formName').submit();
}
}
function transferLeads3(orid,maid){
if(maid==2)
var flag = confirm('Clicking the OK button will transfer all leads in this order to your active EarnPro account. Do you want to transfer these leads now?');
else if(maid==3)
var flag = confirm('Are you sure you want to post these leads to your DFI LIVE account? All leads are automatically imported into DFI LIVE');
else if(maid==9)
var flag = confirm('Are you sure you want to post these leads to your PlatinumNow account? All leads are automatically imported into PlatinumNow');
else if(maid==10)
var flag = confirm('Are you sure you want to post these leads to your YourDestinyTeam account? All leads are automatically imported into YourDestinyTeam');
else if(maid==14)
var flag = confirm('Are you sure you want to post these leads to your OurSimpleWealth account? All leads are automatically imported into OurSimpleWealth');
else if(maid==23)
var flag = confirm('Are you sure you want to post these leads to your EarnVacations account? All leads are automatically imported into EarnVacations');
else if(maid==28)
var flag = confirm('Are you sure you want to post these leads to your EcoBusiness account? All leads are automatically imported into EcoBusiness');
if(flag){
document.getElementById('Action').value='transferleads3';
document.getElementById('formName').submit();
}
}
function transferIndividualLead(orid,leid,maid){
var marketingSystem = '';
if(maid==2)
marketingSystem = 'EarnProDialer';
else if(maid==3)
marketingSystem = 'DFI LIVE';
else if(maid==10)
marketingSystem = 'YourDestinyTeam';
else if(maid==14)
marketingSystem = 'OurSimpleWealth';
var flag = confirm('Are you sure you want to post this lead to your '+marketingSystem+' account? It will automatically imported into '+marketingSystem);
if(flag){
document.getElementById('Action').value='transferIndividualLead';
document.getElementById('formName').submit();
}
}
function singleTransferLead(orid,leid){
saveData('../../../client/singletransferlead.php?orid='+orid+'&leid='+leid);
loadFragmentInToElement('../../../client/showleads.php?orid='+orid,'ajaxBlock','The system is processing successfully transfer this #'+leid+' lead.');
}
function inviteFriends(){
document.getElementById('ajaxBlock').innerHTML = '
Loading...
';
loadFragmentInToElement('../../../client/invitefriends.php','ajaxBlock','');
}
function viewTicket(tcid){
document.getElementById('ajaxBlock').innerHTML = '
Loading...
';
loadFragmentInToElement('../../../client/viewticket.php?tcid='+tcid,'ajaxBlock','');
}
function viewLeadDetails(leid,orid){
document.getElementById('ajaxBlock').innerHTML = '
Loading...
';
loadFragmentInToElement('../../../client/viewleaddetails.php?leid='+leid+'&orid='+orid,'ajaxBlock','');
}
function viewLeadDetails2(leid,orid,linkFromSearchLeads){
document.getElementById('ajaxBlock').innerHTML = '
Loading...
';
loadFragmentInToElement('../../../client/viewleaddetails.php?leid='+leid+'&orid='+orid+'&linkFromSearchLeads='+linkFromSearchLeads,'ajaxBlock','');
}
function printForm(leid){
window.showModalDialog('../../../client/printform.php?leid='+leid,window,'dialogWidth:700px;dialogHeight:650px;edge:Raised;center:Yes;help:No;status:No;scroll:1;');
}
function saveClient() {
if (wwsAFPexists('Frist Name')){
if (wwsAFPget('Frist Name').value==''){return cancelsubmit('Field \'Frist Name\' is required','Frist Name')}
}
if (wwsAFPexists('Last Name')){
if (wwsAFPget('Last Name').value==''){return cancelsubmit('Field \'Last Name\' is required','Last Name')}
}
if (wwsAFPexists('Email ID')){
if (wwsAFPget('Email ID').value==''){return cancelsubmit('Field \'E-Mail\' is required','Email ID')}
if (!isEmail(wwsAFPget('Email ID').value)){return cancelsubmit('Field \'E-Mail\' does not contain a valid e-mail address.','Email ID')}
}
if (wwsAFPexists('Address')){
if (wwsAFPget('Address').value==''){return cancelsubmit('Field \'Address\' is required','Address')}
}
if (wwsAFPexists('City')){
if (wwsAFPget('City').value==''){return cancelsubmit('Field \'City\' is required','City')}
}
if (wwsAFPexists('Zip/Postal Code')){
if (wwsAFPget('Zip/Postal Code').value==''){return cancelsubmit('Field \'Zip/Postal Code\' is required','Zip/Postal Code')}
}
if (wwsAFPexists('Phone')){
if (wwsAFPget('Phone').value==''){return cancelsubmit('Field \'Phone\' is required','Phone')}
}
document.getElementById('formName').submit();
//window.document.location.href = 'index.php';
}
function requestChargeBack(leid,orid){
if (wwsAFPexists('Bad Lead Replacement Request')){
if (wwsAFPget('Bad Lead Replacement Request').value==''){return cancelsubmit('Field \'Bad Lead Replacement Request\' is required','Bad Lead Replacement Request')}
}
document.getElementById('formName').submit();
loadFragmentInToElement('../../../client/viewleaddetails.php?leid='+leid+'&orid='+orid,'ajaxBlock','');
}
function showCBs(){
document.getElementById('ajaxBlock').innerHTML = '
Loading...
';
loadFragmentInToElement('../../../client/showcbs.php','ajaxBlock','');
}
function viewCBLeadDetails(leid){
document.getElementById('ajaxBlock').innerHTML = '
Loading...
';
loadFragmentInToElement('../../../client/viewcbleaddetails.php?leid='+leid,'ajaxBlock','');
}
function loadSupport(){
document.getElementById('ajaxBlock').innerHTML = '
Loading...
';
loadFragmentInToElement('../../../client/request_support.php','ajaxBlock','');
}
function sendSupport(){
if (wwsAFPexists('Your Question')){
if (wwsAFPget('Your Question').value==''){return cancelsubmit('Field \'Your Question\' is required','Your Question')}
}
document.getElementById('formName').submit();
loadFragmentInToElement('../../../client/home.php','ajaxBlock','');
}
function rateIt(vote,lomid){
var params = 'vote='+vote+'&lomid='+lomid;
savePostData('../../../client/saveleadrate.php',params);
loadFragmentInToElement('../../../client/showallleads.php','ajaxBlock','The system is processing successfully rate your lead.');
}
function leadRateIt(vote,lomid,orid,leid){
var params = 'vote='+vote+'&lomid='+lomid;
savePostData('../../../client/saveleadrate.php',params);
loadFragmentInToElement('../../../client/viewleaddetails.php?leid='+leid+'&orid='+orid,'ajaxBlock','The system is processing successfully rate your lead.');
}
function autoshipStatus(asid,status){
var params = 'asid='+asid+'&status='+status;
var flag = confirm('Are you sure you want to cancel this order?');
if(flag){
savePostData('../../../client/saveautoshipstatus.php',params);
loadFragmentInToElement('../../../client/showautoship.php','ajaxBlock','The system is processing successfully update autoship status.');
}
}
function popPaused(orid,status){
var flag = confirm('Do you want to pause activate/inactivate your order');
if(flag){
saveData('../../../client/setpasueorder.php?orid='+orid+'&status='+status);
loadFragmentInToElement('../../../client/showorders.php','ajaxBlock','The system is processing successfully paused activate/inactivate this order.');
}
}
function popNormalPaused(orid,status){
var flag = confirm('Do you want to pause activate/inactivate your order');
if(flag){
saveData('../../../client/setpasuenormalorder.php?orid='+orid+'&status='+status);
loadFragmentInToElement('../../../client/showorders.php','ajaxBlock','The system is processing successfully paused activate/inactivate this order.');
}
}
function popCanceled(orid,status){
var flag = confirm('Do you want to cancel activate/inactivate your order');
if(flag){
saveData('../../../client/setcancelorder.php?orid='+orid+'&status='+status);
loadFragmentInToElement('../../../client/showorders.php','ajaxBlock','The system is processing successfully canceled activate/inactivate this order.');
}
}
function clientLocalLeadType(orid,from){
document.getElementById('ajaxBlock').innerHTML = '
Loading...
';
loadFragmentInToElement('../../../client/clientlocalleadtype.php?orid='+orid+'&from='+from,'ajaxBlock','');
}
function checkAreaCode(){
var flag = 0;
if (wwsAFPexists('AreaCode0')){
if (wwsAFPget('AreaCode0').value!='') flag = 1;
}
if (wwsAFPexists('AreaCode1')){
if (wwsAFPget('AreaCode1').value!='') flag = 1;
}
if (wwsAFPexists('AreaCode2')){
if (wwsAFPget('AreaCode2').value!='') flag = 1;
}
if (wwsAFPexists('AreaCode3')){
if (wwsAFPget('AreaCode3').value!='') flag = 1;
}
if (wwsAFPexists('AreaCode4')){
if (wwsAFPget('AreaCode4').value!='') flag = 1;
}
if(flag==0){
return cancelsubmit('You must enter at least 1 Area Code','AreaCode0');
}
document.getElementById('Action').value = 'checkclientareacode';
document.getElementById('formName').submit();
}
function updateAreaCode(orid){
document.getElementById('Action').value = 'changeclientareacode';
document.getElementById('formName').submit();
}
function showAffiliateSignups(){
document.getElementById('ajaxBlock').innerHTML = '
Loading...
';
loadFragmentInToElement('../../../client/affsignups.php','ajaxBlock','');
}
function showSignupCoupons(){
document.getElementById('ajaxBlock').innerHTML = '
Loading...
';
loadFragmentInToElement('../../../client/affsignupcoupons.php','ajaxBlock','');
}
function Mod10(ccNumb) {
var valid = '0123456789'
var len = ccNumb.length;
var iCCN = parseInt(ccNumb);
var sCCN = ccNumb.toString();
sCCN = sCCN.replace (/^\s+|\s+$/g,'');
var iTotal = 0;
var bNum = true;
var bResult = false;
var temp;
var calc;
for (var j=0; j= 15){
for(var i=len;i>0;i--){
calc = parseInt(iCCN) % 10;
calc = parseInt(calc);
iTotal += calc;
i--;
iCCN = iCCN / 10;
calc = parseInt(iCCN) % 10 ;
calc = calc *2;
switch(calc){
case 10: calc = 1; break;
case 12: calc = 3; break;
case 14: calc = 5; break;
case 16: calc = 7; break;
case 18: calc = 9; break;
default: calc = calc;
}
iCCN = iCCN / 10;
iTotal += calc;
} // END OF LOOP
if ((iTotal%10)==0){
bResult = true;
} else {
bResult = false;
}
}
}
return bResult;
}