function m_eventHandler()
 {
     if (!isset($this->request['action'])) {
         $this->request['action'] = "";
     }
     $action = explode(".", $this->request['action']);
     switch ($action[0]) {
         case "user":
             $obUserInterface = new c_userInterface();
             $obUserInterface->obTpl = $this->obTpl;
             $obUserInterface->obDb = $this->obDb;
             $obUserInterface->request = $this->request;
             $obUserDb = new c_userDb();
             $obUserDb->obDb = $this->obDb;
             $obUserDb->request = $this->request;
             if (!isset($action[1])) {
                 $action[1] = "";
             }
             switch ($action[1]) {
                 case "home":
                     $obUserInterface->userTemplate = $this->templatePath . "userDisplayHome.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BODY", $obUserInterface->m_dspCustomers());
                     break;
                 case "dspForm":
                     $obUserInterface->userTemplate = $this->templatePath . "userForm.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BODY", $obUserInterface->m_dspUserForm());
                     break;
                 case "status":
                     $obUserInterface->userTemplate = $this->templatePath . "status.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BODY", $obUserInterface->m_userStatus());
                     break;
                 case "details":
                     $obUserInterface->userTemplate = $this->templatePath . "userDetails.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BODY", $obUserInterface->dspUserDetails());
                     break;
                 case "sendpass":
                     $obUserInterface->m_sendPassword();
                     break;
                 case "updateUser":
                     $this->libfunc->check_token();
                     if (isset($this->request['mode']) && $this->request['mode'] == "edit") {
                         $checkValue = $obUserInterface->m_verifyEditUser();
                         if ($checkValue == 0) {
                             $obUserDb->m_updateUser();
                         } else {
                             $obUserInterface->request['id'] = $this->request['id'];
                             $obUserInterface->userTemplate = $this->templatePath . "userForm.tpl.htm";
                             $this->obTpl->set_var("TPL_VAR_BODY", $obUserInterface->m_dspUserForm());
                         }
                     } else {
                         $checkValue = $obUserInterface->m_verifyInsertUser();
                         if ($checkValue == 0) {
                             $obUserDb->m_insertUser();
                         } else {
                             $obUserInterface->userTemplate = $this->templatePath . "userForm.tpl.htm";
                             $this->obTpl->set_var("TPL_VAR_BODY", $obUserInterface->m_dspUserForm());
                         }
                     }
                     break;
                 case "changestatus":
                     $this->libfunc->check_token();
                     $obUserDb->m_changeStatus();
                     break;
                 default:
                     $obUserInterface->userTemplate = $this->templatePath . "userDisplayHome.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BODY", $obUserInterface->m_dspCustomers());
                     break;
             }
             break;
             #END CUSTOMER
         #END CUSTOMER
         case "enquiry":
             $obEnquiryInterface = new c_enquiryInterface();
             $obEnquiryInterface->obTpl = $this->obTpl;
             $obEnquiryInterface->obDb = $this->obDb;
             $obEnquiryInterface->request = $this->request;
             switch ($action[1]) {
                 case "home":
                     $obEnquiryInterface->contactTemplate = $this->templatePath . "enquiriesHome.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BODY", $obEnquiryInterface->m_dspEnquiries());
                     break;
                 case "details":
                     $obEnquiryInterface->contactTemplate = $this->templatePath . "enquiriesDetails.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BODY", $obEnquiryInterface->dspEnquiryDetails());
                     break;
                 case "deleteEnq":
                     $this->libfunc->check_token();
                     $obEnquiryInterface->m_deleteEnquiries();
                     break;
                 case "delete":
                     $this->libfunc->check_token();
                     $obEnquiryInterface->m_deleteEnquiry();
                     break;
             }
             break;
         case "supplier":
             $obSupplierInterface = new c_supplierInterface();
             $obSupplierInterface->obTpl = $this->obTpl;
             $obSupplierInterface->obDb = $this->obDb;
             $obSupplierInterface->request = $this->request;
             $obSupplierInterface->imagePath = SITE_PATH . "images/";
             $obSupplierInterface->imageUrl = SITE_URL . "images/";
             $obSupplierDb = new c_supplierDb();
             $obSupplierDb->obDb = $this->obDb;
             $obSupplierDb->request = $this->request;
             $obSupplierDb->imagePath = SITE_PATH . "images/";
             switch ($action[1]) {
                 case "home":
                     $obSupplierInterface->supplierTemplate = $this->templatePath . "suppliersHome.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BODY", $obSupplierInterface->m_dspSuppliers());
                     break;
                 case "dspForm":
                     $obSupplierInterface->supplierTemplate = $this->templatePath . "suppliersForm.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BODY", $obSupplierInterface->m_dspSupplierForm());
                     break;
                 case "updateSupplier":
                     $this->libfunc->check_token();
                     if (isset($this->request['mode']) && $this->request['mode'] == "edit") {
                         if (!$obSupplierInterface->m_verifyEditSupplier()) {
                             $obSupplierDb->m_updateSupplier();
                         } else {
                             $obSupplierInterface->request['id'] = $this->request['id'];
                             $obSupplierInterface->supplierTemplate = $this->templatePath . "suppliersForm.tpl.htm";
                             $this->obTpl->set_var("TPL_VAR_BODY", $obSupplierInterface->m_dspSupplierForm());
                         }
                     } else {
                         if (!$obSupplierInterface->m_verifyInsertSupplier()) {
                             $obSupplierDb->m_insertSupplier();
                         } else {
                             $obSupplierInterface->supplierTemplate = $this->templatePath . "suppliersForm.tpl.htm";
                             $this->obTpl->set_var("TPL_VAR_BODY", $obSupplierInterface->m_dspSupplierForm());
                         }
                     }
                     break;
                 case "uploadForm":
                     $obSupplierInterface->uploadTemplate = MODULES_PATH . "default/templates/admin/upload.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BODY", $obSupplierInterface->m_uploadForm());
                     break;
                 case "upload":
                     $this->libfunc->check_token();
                     if (!$obSupplierInterface->m_verifyImageUpload()) {
                         $obSupplierDb->m_uploadImage();
                     } else {
                         $obSupplierInterface->uploadTemplate = MODULES_PATH . "default/templates/admin/upload.tpl.htm";
                         $this->obTpl->set_var("TPL_VAR_BODY", $obSupplierInterface->m_uploadForm());
                     }
                     break;
                 case "delete":
                     $this->libfunc->check_token();
                     $obSupplierDb->m_deleteSupplier();
                     break;
             }
             break;
             #END SUPPLIER
         #END SUPPLIER
         case "security":
             $obSecurityInterface = new c_securityInterface();
             $obSecurityInterface->obTpl = $this->obTpl;
             $obSecurityInterface->obDb = $this->obDb;
             $obSecurityInterface->request = $this->request;
             $obSecurityDb = new c_securityDb();
             $obSecurityDb->obDb = $this->obDb;
             $obSecurityDb->request = $this->request;
             switch ($action[1]) {
                 case "home":
                     $obSecurityInterface->adminTemplate = $this->templatePath . "adminUsers.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BODY", $obSecurityInterface->m_dspAdminUsers());
                     break;
                 case "createAdmin":
                     $obSecurityInterface->adminTemplate = $this->templatePath . "createAdminForm.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BODY", $obSecurityInterface->m_createAdminForm());
                     break;
                 case "addAdmin":
                     $this->libfunc->check_token();
                     if (isset($this->request['mode']) && $this->request['mode'] == "edit") {
                         if ($obSecurityInterface->m_verifyEditAdmin() == 1) {
                             $obSecurityDb->m_updateAdmin();
                         } else {
                             if ($obSecurityInterface->m_verifyEditAdmin() == 2) {
                                 $obSecurityInterface->request['msg'] = 1;
                             }
                             if ($obSecurityInterface->m_verifyEditAdmin() == 3) {
                                 $obSecurityInterface->request['msg'] = 2;
                             }
                             $obSecurityInterface->request['adminid'] = $this->request['adminid'];
                             $obSecurityInterface->adminTemplate = $this->templatePath . "createAdminForm.tpl.htm";
                             $this->obTpl->set_var("TPL_VAR_BODY", $obSecurityInterface->m_createAdminForm());
                         }
                     } else {
                         if ($obSecurityInterface->m_verifyInsertAdmin() == 1) {
                             $obSecurityDb->m_insertAdmin();
                         } else {
                             if ($obSecurityInterface->m_verifyInsertAdmin() == 2) {
                                 $obSecurityInterface->request['msg'] = 1;
                             }
                             if ($obSecurityInterface->m_verifyInsertAdmin() == 3) {
                                 $obSecurityInterface->request['msg'] = 2;
                             }
                             $obSecurityInterface->adminTemplate = $this->templatePath . "createAdminForm.tpl.htm";
                             $this->obTpl->set_var("TPL_VAR_BODY", $obSecurityInterface->m_createAdminForm());
                         }
                     }
                     break;
                 case "deleteAdmin":
                     $this->libfunc->check_token();
                     $obSecurityDb->m_deleteAdmin();
                     break;
             }
             break;
             #END SECURITY
             #HANDLING HELP PAGES
         #END SECURITY
         #HANDLING HELP PAGES
         case "help":
             $this->Template = MODULES_PATH . "default/templates/admin/helpOuter.htm";
             $this->obTpl->set_file("mainContent", $this->Template);
             switch ($action[1]) {
                 case "security":
                     $this->Template = MODULES_PATH . "default/templates/help/admin_security.htm";
                     $this->obTpl->set_file("innerContent", $this->Template);
                     $this->obTpl->set_var("TPL_VAR_HELPBODY", $this->obTpl->parse("return", "innerContent"));
                     break;
                 case "users":
                     $this->Template = MODULES_PATH . "default/templates/help/admin_users.htm";
                     $this->obTpl->set_file("innerContent", $this->Template);
                     $this->obTpl->set_var("TPL_VAR_HELPBODY", $this->obTpl->parse("return", "innerContent"));
                     break;
                 case "customer":
                     $this->Template = MODULES_PATH . "default/templates/help/customer.htm";
                     $this->obTpl->set_file("innerContent", $this->Template);
                     $this->obTpl->set_var("TPL_VAR_HELPBODY", $this->obTpl->parse("return", "innerContent"));
                     break;
                 case "contact":
                     $this->Template = MODULES_PATH . "default/templates/help/contact.htm";
                     $this->obTpl->set_file("innerContent", $this->Template);
                     $this->obTpl->set_var("TPL_VAR_HELPBODY", $this->obTpl->parse("return", "innerContent"));
                     break;
                 case "supplier":
                     $this->Template = MODULES_PATH . "default/templates/help/suppliers.htm";
                     $this->obTpl->set_file("innerContent", $this->Template);
                     $this->obTpl->set_var("TPL_VAR_HELPBODY", $this->obTpl->parse("return", "innerContent"));
                     break;
             }
             $this->obTpl->pparse("return", "mainContent");
             exit;
             break;
         case "logout":
             session_destroy();
             header("Location:" . SITE_URL . "adminindex.php");
             break;
         case "unauthorized":
             $this->Template = MODULES_PATH . "default/templates/admin/unAutherized.tpl.htm";
             $this->obTpl->set_file("Content", $this->Template);
             $this->obTpl->set_var("TPL_VAR_BODY", $this->obTpl->parse("return", "Content"));
             break;
         default:
             if (isset($_SESSION['uname']) && trim($_SESSION['uname']) != "") {
                 header("Location:" . SITE_URL . "user/adminindex.php?action=user.home");
                 exit;
             } else {
                 header("Location:" . SITE_URL . "adminindex.php");
                 exit;
             }
     }
     #END SWITCH CASE
 }
 function m_eventHandler()
 {
     if (!isset($this->request['action'])) {
         $this->request['action'] = "";
     }
     $action = explode(".", $this->request['action']);
     if (!isset($action[1])) {
         $action[1] = "";
     }
     $this->libFunc = new c_libFunctions();
     $obUserInterface = new c_userInterface();
     $obUserInterface->obTpl =& $this->obTpl;
     $obUserInterface->obDb = $this->obDb;
     $obUserInterface->request = $this->request;
     switch ($action[0]) {
         case "user":
             $obUserDb = new c_userDb();
             $obUserDb->obDb = $this->obDb;
             $obUserDb->request = $this->request;
             switch ($action[1]) {
                 case "loginForm":
                     //$_SESSION['referer']=$_SERVER['HTTP_REFERER'];
                     $obUserInterface->userTemplate = $this->templatePath . "loginForm.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", " » Customer Login");
                     $this->obTpl->set_var("TPL_VAR_BODY", $obUserInterface->m_loginForm());
                     break;
                 case "home":
                     $retUrl = $this->libFunc->m_safeUrl(SITE_URL . "user/index.php?action=user.home");
                     $_SESSION['referer'] = $retUrl;
                     $this->libFunc->authenticate();
                     unset($_SESSION['referer']);
                     //	$this->obTpl->set_var("TPL_VAR_BREDCRUMBS"," » My Account");
                     $obUserInterface->userTemplate = $this->templatePath . "userAccount.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BODY", $obUserInterface->m_dspUserAccount());
                     break;
                 case "checkLogin":
                     if ($obUserInterface->m_checkLogin() == 1) {
                         $obUserInterface->userTemplate = $this->templatePath . "loginForm.tpl.htm";
                         $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", " » Customer Login");
                         $this->obTpl->set_var("TPL_VAR_BODY", $obUserInterface->m_loginForm());
                     } else {
                         if (isset($_SESSION['referer'])) {
                             header("Location:" . $_SESSION['referer']);
                             exit;
                         } else {
                             $retUrl = $this->libFunc->m_safeUrl(SITE_URL . "index.php");
                             header("Location:" . $retUrl);
                             exit;
                         }
                     }
                     break;
                 case "update":
                     if ($obUserInterface->m_verifyEditUser() == 1) {
                         $this->libFunc->authenticate();
                         $this->libFunc->check_token();
                         $obUserInterface->request['mode'] = "editDetails";
                         $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", " » My Account");
                         $obUserInterface->userTemplate = $this->templatePath . "userAccount.tpl.htm";
                         $this->obTpl->set_var("TPL_VAR_BODY", $obUserInterface->m_dspUserAccount());
                     } else {
                         $obUserDb->m_updateUser();
                     }
                     break;
                 case "updatePass":
                     if ($obUserInterface->m_verifyEditPass() == 1) {
                         $this->libFunc->authenticate();
                         $obUserInterface->request['mode'] = "changePass";
                         $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", " » My Account");
                         $obUserInterface->userTemplate = $this->templatePath . "userAccount.tpl.htm";
                         $this->obTpl->set_var("TPL_VAR_BODY", $obUserInterface->m_dspUserAccount());
                     } else {
                         $this->libFunc->check_token();
                         $obUserDb->m_updatePass();
                     }
                     break;
                 case "logout":
                     session_destroy();
                     if (isset($_SESSION['referer']) && !empty($_SESSION['referer'])) {
                         $retUrl = $_SESSION['referer'];
                     } else {
                         $retUrl = $this->libFunc->m_safeUrl(SITE_URL . "user/index.php?action=user.loginForm");
                     }
                     header("Location:" . $retUrl);
                     break;
                 case "signupForm":
                     $obUserInterface->userTemplate = $this->templatePath . "signup.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", " » New account");
                     $this->obTpl->set_var("TPL_VAR_BODY", $obUserInterface->m_dspSignupForm());
                     break;
                 case "insert":
                     if ($obUserInterface->m_verifyInsertUser() == 1) {
                         $obUserInterface->userTemplate = $this->templatePath . "signup.tpl.htm";
                         $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", " » New account");
                         $this->obTpl->set_var("TPL_VAR_BODY", $obUserInterface->m_dspSignupForm());
                     } else {
                         $obUserDb->m_insertUser();
                     }
                     break;
                 case "addnewsletter":
                     $obUserDb->m_newsletter();
                     break;
                 case "emailPass":
                     $this->libFunc->check_token();
                     $obUserInterface->m_sendPassword();
                     break;
                 case "recover":
                     $obUserInterface->userTemplate = $this->templatePath . "resetpassword.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", " » Reset Password");
                     $this->obTpl->set_var("TPL_VAR_BODY", $obUserInterface->m_reset_Password());
                     break;
                 case "recoversave":
                     $this->libFunc->check_token();
                     $obUserInterface->m_save_new_Password();
                     break;
                 default:
                     $retUrl = $this->libFunc->m_safeUrl(SITE_URL . "user/index.php?action=user.home");
                     $_SESSION['referer'] = $retUrl;
                     $this->libFunc->authenticate();
                     unset($_SESSION['referer']);
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", " » My Account");
                     $obUserInterface->userTemplate = $this->templatePath . "userAccount.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BODY", $obUserInterface->m_dspUserAccount());
                     break;
             }
             break;
             #END CUSTOMER
         #END CUSTOMER
         default:
             $retUrl = $this->libFunc->m_safeUrl(SITE_URL . "user/index.php?action=user.home");
             $_SESSION['referer'] = $retUrl;
             $this->libFunc->authenticate();
             unset($_SESSION['referer']);
             $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", " » My Account");
             $obUserInterface->userTemplate = $this->templatePath . "userAccount.tpl.htm";
             $this->obTpl->set_var("TPL_VAR_BODY", $obUserInterface->m_dspUserAccount());
             break;
     }
     #END SWITCH CASE
 }
 function m_eventHandler()
 {
     if (!isset($this->request['action'])) {
         $this->request['action'] = "";
     }
     $action = explode(".", $this->request['action']);
     $member = explode("=", $this->request['action']);
     if (!isset($this->request['mode'])) {
         $this->request['mode'] = "";
     }
     if (!isset($action[1])) {
         $action[1] = "";
     }
     switch ($action[0]) {
         #HANDLING VIEW(FRONTEND-SHOP BUILDER)
         case "ecom":
             $obShopInterface = new c_shopInterface();
             $obShopInterface->obTpl = $this->obTpl;
             $obShopInterface->obDb = $this->obDb;
             $obShopInterface->request = $this->request;
             $obShopInterface->imageUrl = SITE_URL . "images/";
             $obShopInterface->imagePath = SITE_PATH . "images/";
             $obShopDb = new c_shopDb();
             $obShopDb->obTpl = $this->obTpl;
             $obShopDb->obDb = $this->obDb;
             $obShopDb->request = $this->request;
             $obBill = new c_billShipInfo();
             $obBill->obTpl = $this->obTpl;
             $obBill->obDb = $this->obDb;
             $obBill->request = $this->request;
             $obSearch = new c_search();
             $obSearch->obTpl = $this->obTpl;
             $obSearch->obDb = $this->obDb;
             $obSearch->request = $this->request;
             $obBrand = new c_brand();
             $obBrand->obTpl = $this->obTpl;
             $obBrand->obDb = $this->obDb;
             $obBrand->request = $this->request;
             switch ($action[1]) {
                 case "search":
                     $obSearch->searchTemplate = $this->templatePath . "searchPage.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo; <a href='#'>Search Results</a>");
                     $this->obTpl->set_var("TPL_VAR_BODY", $obSearch->m_searchResults());
                     break;
                 case "brand":
                     $obBrand->brandTemplate = $this->templatePath . "brandPage.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo; <a href='#'>Brand Results</a>");
                     $this->obTpl->set_var("TPL_VAR_BODY", $obBrand->m_brandResults());
                     break;
                 case "details":
                     if ($obShopInterface->m_checkMemberPage()) {
                         $retUrl = $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=ecom.details&mode=" . $this->request['mode']);
                         $_SESSION['referer'] = $retUrl;
                         $this->libFunc->authenticate();
                         unset($_SESSION['referer']);
                         $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", $obShopInterface->m_topNavigation('department'));
                         $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_showDeptDetails());
                     } else {
                         $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", $obShopInterface->m_topNavigation('department'));
                         $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_showDeptDetails());
                     }
                     break;
                 case "deptattribute":
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", $obShopInterface->m_topNavigation('department'));
                     $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_showDeptAttributeSort());
                     break;
                 case "pdetails":
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", $obShopInterface->m_topNavigation('product'));
                     $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_showProductDetails());
                     break;
                 case "pfinder":
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo; <a href='#'>Product Finder</a>");
                     $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_ProductFinder());
                     break;
                 case "cdetails":
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", $obShopInterface->m_topNavigation('content'));
                     $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_showContentDetails());
                     break;
                 case "deletereview":
                     $obShopDb->m_deleteReview();
                     break;
                 case "reviewForm":
                     $retUrl = $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=ecom.reviewForm&mode=" . $this->request['mode']);
                     $_SESSION['referer'] = $retUrl;
                     $this->libFunc->authenticate();
                     unset($_SESSION['referer']);
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", $obShopInterface->m_topNavigation('product'));
                     $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_showProductDetails());
                     break;
                 case "largeImg":
                     $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_dspLargeImg());
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", $obShopInterface->breadcrumb);
                     break;
                 case "reviewAdd":
                     $this->libFunc->authenticate();
                     $obShopDb->m_reviewAdd();
                     break;
                 case "help":
                     $retUrl = $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=ecom.help");
                     $_SESSION['referer'] = $retUrl;
                     $this->libFunc->authenticate();
                     unset($_SESSION['referer']);
                     $obShopDb->m_reviewHelp();
                     break;
                 case "noHelp":
                     $retUrl = $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=ecom.noHelp");
                     $_SESSION['referer'] = $retUrl;
                     $this->libFunc->authenticate();
                     unset($_SESSION['referer']);
                     $obShopDb->m_reviewNoHelp();
                     break;
                 case "addtocart":
                     if (!$obShopDb->m_addTocart()) {
                         $obShopInterface->template = $this->templatePath . "viewcart.tpl.htm";
                         $obShopInterface->m_viewCart();
                         $obShopDb->stockTemplate = $this->templatePath . "stockControl.tpl.htm";
                         $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href='#'>Stock control</a>");
                         $this->obTpl->set_var("TPL_VAR_BODY", $obShopDb->m_dspStockMessage());
                     }
                     break;
                 case "addmulticart":
                     if (!$obShopDb->m_addToMulticart()) {
                         $obShopInterface->template = $this->templatePath . "viewcart.tpl.htm";
                         $obShopInterface->m_viewCart();
                         $obShopDb->stockTemplate = $this->templatePath . "stockControl.tpl.htm";
                         $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href='#'>Stock control</a>");
                         $this->obTpl->set_var("TPL_VAR_BODY", $obShopDb->m_dspStockMessage());
                     }
                     break;
                 case "remove":
                     $obShopDb->m_deleteCart();
                     break;
                 case "updateCart":
                     if ($this->request['mode'] == LANG_EMPTYBASKET) {
                         $obShopDb->m_emptyCart();
                     } elseif ($this->request['mode'] == LANG_UPDATEBASKET) {
                         if (!$obShopDb->m_updateCart()) {
                             $obShopDb->stockTemplate = $this->templatePath . "stockControl.tpl.htm";
                             $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href='#'>Stock control</a>");
                             $this->obTpl->set_var("TPL_VAR_BODY", $obShopDb->m_dspStockMessage());
                         }
                     } else {
                         $obShopDb->templatePath = $this->templatePath;
                         $obShopDb->Interface = $obShopInterface;
                         if (!$obShopDb->m_updateCart('1')) {
                             $obShopDb->stockTemplate = $this->templatePath . "stockControl.tpl.htm";
                             $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href='#'>Stock control</a>");
                             $this->obTpl->set_var("TPL_VAR_BODY", $obShopDb->m_dspStockMessage());
                         }
                     }
                     break;
                 case "calcShip":
                     if ($this->request['mode'] == "Get Quote") {
                         $_SESSION['calcShip'] = $this->request['mode'];
                     }
                     $obShopInterface->template = $this->templatePath . "viewcart.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", " &nbsp;&raquo;&nbsp;<a href='#'>Shopping basket</a>");
                     $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_viewCart());
                     break;
                 case "viewcart":
                     $_SESSION['referer'] = SITE_SAFEURL . "ecom/index.php?action=ecom.viewcart";
                     $obShopInterface->template = $this->templatePath . "viewcart.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", " &nbsp;&raquo;&nbsp;<a href='#'>Shopping basket</a>");
                     $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_viewCart());
                     break;
                 case "changepostage":
                     if (DEFAULT_POSTAGE_METHOD == 'zones') {
                         $this->comFunc->m_postageZonePrice($_SESSION['cartweight'], $this->request['countryid'], $_SESSION['grandTotal'], 1, $_SESSION['subtotal'], $_SESSION['grandsubTotal'], $_SESSION['VAT']);
                     } elseif (DEFAULT_POSTAGE_METHOD == 'cities') {
                         $this->comFunc->m_postageCityPrice($_SESSION['cartweight'], $this->request['countryid'], $_SESSION['grandTotal'], 1, $_SESSION['subtotal'], $_SESSION['grandsubTotal'], $_SESSION['VAT'], $this->request['stateid']);
                     }
                     break;
                 case "updateviewcart":
                     $this->comFunc->m_UpdateViewCart();
                     break;
                 case "changecountry":
                     $this->comFunc->m_postageCityCountry($this->request['countryid']);
                     break;
                 case "giftwrap":
                     $cartUrl = $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=ecom.viewcart");
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href=\"" . $cartUrl . "\">Shopping basket</a>&nbsp;&raquo;&nbsp;<a href='#'>Gift wrap</a>");
                     $obShopInterface->giftTemplate = $this->templatePath . "giftwrap.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_dspGiftWrap());
                     break;
                 case "giftAdd":
                     $obShopDb->m_addGiftWrap();
                     break;
                 case "removeGift":
                     $obShopDb->m_removeGift();
                     break;
                 case "backitem":
                     $obShopDb->m_backOrderSeperate();
                     break;
                 case "backremove":
                     $obShopDb->m_deleteCart();
                     break;
                 case "instructions":
                     $cartUrl = $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=ecom.viewcart");
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href=\"" . $cartUrl . "\">Shopping basket</a>&nbsp;&raquo;&nbsp;<a href='#'>Backorder instructions</a>");
                     $obShopInterface->giftTemplate = $this->templatePath . "backorder.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_dspBackOrderInstructions());
                     break;
                 default:
                     $obShopInterface->template = $this->templatePath . "viewcart.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href='#'>Shopping basket</a>");
                     $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_viewCart());
                     break;
             }
             break;
         case "checkout":
             $obBill = new c_billShipInfo();
             $obBill->obTpl = $this->obTpl;
             $obBill->obDb = $this->obDb;
             $obBill->request = $this->request;
             $obPayment = new c_payment();
             $obPayment->obTpl = $this->obTpl;
             $obPayment->obDb = $this->obDb;
             $obPayment->request = $this->request;
             $user = new c_userInterface();
             $user->obTpl = $this->obTpl;
             $user->obDb = $this->obDb;
             $user->request = $this->request;
             $obReview = new c_review();
             $obReview->obTpl = $this->obTpl;
             $obReview->obDb = $this->obDb;
             $obReview->request = $this->request;
             $obSaveOrder = new c_saveOrder();
             $obSaveOrder->obTpl = $this->obTpl;
             $obSaveOrder->obDb = $this->obDb;
             $obSaveOrder->request = $this->request;
             $obreceipt = new c_receipt();
             $obreceipt->obTpl = $this->obTpl;
             $obreceipt->obDb = $this->obDb;
             $obreceipt->request = $this->request;
             $this->libFunc = new c_libFunctions();
             $cardSave = new c_cardSave();
             $cardSave->obDb = $this->obDb;
             $cardSave->obTpl = $this->obTpl;
             $cardSave->request = $this->request;
             $cardSave->libFunc = $this->libFunc;
             switch ($action[1]) {
                 case "login":
                     $obBill->m_checkLogin();
                     $obBill->loginTemplate = $this->templatePath . "checkoutLogin.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href='#'>Login</a>");
                     $this->obTpl->set_var("TPL_VAR_BODY", $obBill->m_checkoutLoginForm());
                     break;
                 case "lost":
                     $user->cart = 1;
                     $user->m_sendPassword();
                     $obBill->loginTemplate = $this->templatePath . "checkoutLogin.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href='#'>Login</a>");
                     $this->obTpl->set_var("TPL_VAR_BODY", $obBill->m_checkoutLoginForm());
                     break;
                 case "loginForm":
                     $obBill->loginTemplate = $this->templatePath . "checkoutLogin.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href='#'>Login</a>");
                     $this->obTpl->set_var("TPL_VAR_BODY", $obBill->m_checkoutLoginForm());
                     break;
                 case "logout":
                     session_destroy();
                     $retUrl1 = $this->libFunc->m_safeUrl(SITE_SAFEURL . "ecom/index.php?action=checkout.billing");
                     $_SESSION['referer'] = $retUrl1;
                     $this->libFunc->authenticate();
                     unset($_SESSION['referer']);
                     $retUrl = $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=checkout.login");
                     header("Location:" . $retUrl);
                     break;
                 case "billing":
                     $this->comFunc->m_checkShoppingCart();
                     $retUrl = $this->libFunc->m_safeUrl(SITE_SAFEURL . "ecom/index.php?action=checkout.billing");
                     //$_SESSION['referer']=$retUrl;
                     #IF WITHOUT LOGIN CHECKUT SELECTED
                     //if(!isset($this->request['email']) && empty($this->request['email'])){
                     #IF EMAIL NOT SPECIFIED THEN CHECK LOGIN DETAILS
                     //$this->libFunc->m_cartAuthenticate();
                     //session_unregister('referer');
                     //}
                     $cartUrl = $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=ecom.viewcart");
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href=\"" . $cartUrl . "\">Shopping basket</a>&nbsp;&raquo;&nbsp;<a href='#'>Billing &amp; delivery address</a>");
                     unset($_SESSION['referer']);
                     $obBill->billShipTemplate = $this->templatePath . "ConfirmOrderAndBillShip.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BODY", $obBill->m_billShipInfoForm());
                     break;
                 case "billingerr":
                     $this->comFunc->m_checkShoppingCart();
                     $retUrl = $this->libFunc->m_safeUrl(SITE_SAFEURL . "ecom/index.php?action=checkout.billing");
                     //$_SESSION['referer']=$retUrl;
                     #IF WITHOUT LOGIN CHECKUT SELECTED
                     //if(!isset($this->request['email']) && empty($this->request['email'])){
                     #IF EMAIL NOT SPECIFIED THEN CHECK LOGIN DETAILS
                     //$this->libFunc->m_cartAuthenticate();
                     //session_unregister('referer');
                     //}
                     $cartUrl = $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=ecom.viewcart");
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href=\"" . $cartUrl . "\">Shopping basket</a>&nbsp;&raquo;&nbsp;<a href='#'>Billing &amp; delivery address</a>");
                     unset($_SESSION['referer']);
                     $obBill->billShipTemplate = $this->templatePath . "ConfirmOrderAndBillShip.tpl.htm";
                     $obBill->err = 1;
                     $obBill->errMsg = 'There was a problem with your payment details.';
                     $this->obTpl->set_var("TPL_VAR_BODY", $obBill->m_billShipInfoForm());
                     break;
                 case "addBillShipInfo":
                     $this->comFunc->m_checkShoppingCart();
                     $result = $obBill->m_verifyBillShipAdd();
                     if ($result) {
                         echo "||ERROR||1||" . $result . "||";
                     } else {
                         $obBill->m_saveBillShipInfo();
                     }
                     break;
                 case "shipping":
                     $this->comFunc->m_checkShoppingCart();
                     $retUrl = $this->libFunc->m_safeUrl(SITE_SAFEURL . "ecom/index.php?action=checkout.billing");
                     $_SESSION['referer'] = $retUrl;
                     $this->libFunc->m_cartAuthenticate();
                     unset($_SESSION['referer']);
                     $obBill->postageTemplate = $this->templatePath . "ConfirmOrderAndBillShip.tpl.htm";
                     $cartUrl = $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=ecom.viewcart");
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href=\"" . $cartUrl . "\">Shopping basket</a>&nbsp;&raquo;&nbsp;<a href='#'>Postage information</a>");
                     $this->obTpl->set_var("TPL_VAR_BODY", $obBill->m_postageSelect());
                     break;
                 case "updatePostage":
                     $this->comFunc->m_checkShoppingCart();
                     $obBill->m_updatePostage();
                     break;
                 case "payment":
                     $this->comFunc->m_checkShoppingCart();
                     $retUrl = $this->libFunc->m_safeUrl(SITE_SAFEURL . "ecom/index.php?action=checkout.billing");
                     $_SESSION['referer'] = $retUrl;
                     $this->libFunc->m_cartAuthenticate();
                     unset($_SESSION['referer']);
                     $obPayment->paymentTemplate = $this->templatePath . "payment.tpl.htm";
                     $cartUrl = $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=ecom.viewcart");
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href=\"" . $cartUrl . "\">Shopping basket</a>&nbsp;&raquo;&nbsp;<a href='#'>Choose a payment method</a>");
                     $this->obTpl->set_var("TPL_VAR_BODY", $obPayment->m_paymentMethods());
                     break;
                 case "review":
                     $siteUrl = SITE_URL . "ecom/index.php?action=checkout.billing";
                     $this->libFunc->m_mosRedirect($this->libFunc->m_safeUrl($siteUrl));
                     break;
                 case "reviewit":
                     $this->comFunc->m_checkShoppingCart();
                     $retUrl = $this->libFunc->m_safeUrl(SITE_SAFEURL . "ecom/index.php?action=checkout.billing");
                     $_SESSION['referer'] = $retUrl;
                     $this->libFunc->m_cartAuthenticate();
                     unset($_SESSION['referer']);
                     if ($obPayment->m_verifyPaymentGateway()) {
                         $obPayment->paymentTemplate = $this->templatePath . "payment.tpl.htm";
                         //$paymentUrl=$this->libFunc->m_safeUrl(SITE_URL."ecom/index.php?action=checkout.payment");
                         $paymentUrl = $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=checkout.billing");
                         $cartUrl = $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=ecom.viewcart");
                         $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href=\"" . $cartUrl . "\">Shopping basket</a>&nbsp;&raquo;&nbsp;<a href=\"" . $paymentUrl . "\">Billing & delivery address</a>&nbsp;&raquo;&nbsp;<a href='#'>Review your order</a>");
                         $this->obTpl->set_var("TPL_VAR_BODY", $obPayment->m_paymentMethods());
                     } else {
                         $obReview->libFunc = $this->libFunc;
                         $obReview->reviewTemplate = $this->templatePath . "review.tpl.htm";
                         //$paymentUrl=$this->libFunc->m_safeUrl(SITE_URL."ecom/index.php?action=checkout.payment");
                         $paymentUrl = $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=checkout.billing");
                         $cartUrl = $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=ecom.viewcart");
                         $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href=\"" . $cartUrl . "\">Shopping basket</a>&nbsp;&raquo;&nbsp;<a href=\"" . $paymentUrl . "\">Billing & delivery address</a>&nbsp;&raquo;&nbsp;<a href='#'>Review your order</a>");
                         $this->obTpl->set_var("TPL_VAR_BODY", $obReview->m_reviewCheckout());
                     }
                     break;
                 case "saveorder":
                     $obSaveOrder->cardsaveTemplate = $this->templatePath . "cardsave.tpl.htm";
                     $this->comFunc->m_checkShoppingCart();
                     $retUrl = $this->libFunc->m_safeUrl(SITE_SAFEURL . "ecom/index.php?action=checkout.billing");
                     $_SESSION['referer'] = $retUrl;
                     $this->libFunc->m_cartAuthenticate();
                     unset($_SESSION['referer']);
                     $obSaveOrder->worldpayTemplate = $this->templatePath . "worldpay.tpl.htm";
                     $obSaveOrder->secpayTemplate = $this->templatePath . "secpay.tpl.htm";
                     $obSaveOrder->hsbcTemplate = $this->templatePath . "hsbc.tpl.htm";
                     $obSaveOrder->barclayTemplate = $this->templatePath . "barclay.tpl.htm";
                     $obSaveOrder->paypalTemplate = $this->templatePath . "paypal.tpl.htm";
                     $obSaveOrder->offSTTemplate = $this->templatePath . "offst.tpl.htm";
                     #(BEGIN) SAGEPAY INTEGRATION
                     $obSaveOrder->sagepayTemplate = $this->templatePath . "sageform.tpl.htm";
                     #(END) SAGEPAY INTEGRATION
                     $this->comFunc->m_checkShoppingCart();
                     $obBill->errMsg = $obSaveOrder->m_saveOrderData();
                     //$obSaveOrder->m_saveOrderData();
                     $obBill->billShipTemplate = $this->templatePath . "ConfirmOrderAndBillShip.tpl.htm";
                     $cartUrl = $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=ecom.viewcart");
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href=\"" . $cartUrl . "\">Shopping basket</a>&nbsp;&raquo;&nbsp;<a href='#'>Choose a payment method</a>");
                     unset($_SESSION['userid']);
                     unset($_SESSION['username']);
                     $this->obTpl->set_var("TPL_VAR_BODY", $obBill->m_billShipInfoForm());
                     break;
                 case "return":
                     //PAYPAL AND OTHER RETURN PAGE DISPLAY
                     $obreceipt->template = $this->templatePath . "return.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href=\"#\">Order Confirmation</a>");
                     $this->obTpl->set_var("TPL_VAR_BODY", $obreceipt->m_return());
                     break;
                 case "IPN":
                     //PAYPAL INSTANT PAYMENT NOTIFICATION
                     $result = $obreceipt->m_Paypal_IPN_Notification();
                     if ($result[0] == "1") {
                         $obreceipt->m_sendOrderDetails($result[1]);
                     }
                     break;
                 case "sage3d":
                     $obreceipt->m_Sagepay_3D1();
                     break;
                 case "sage3d2":
                     $obreceipt->m_Sagepay_3D2();
                     break;
                 case "sage3dr":
                     $obreceipt->m_Sagepay_3DR();
                     break;
                 case "cs3d":
                     $cardSave->m_cardSave_3D1();
                     break;
                 case "cs3d2":
                     $cardSave->m_cardSave_3D2();
                     break;
                 case "cs3dr":
                     $cardSave->m_cardSave_3DR();
                     break;
                 case "cshcb":
                     $cardSave->m_cardSave_Hosted_Callback("0");
                     break;
                 case "cshcb2":
                     $cardSave->m_cardSave_Hosted_Callback("1");
                     break;
                 case "process":
                     $obreceipt->processTemplate = $this->templatePath . "orderProcessed.tpl.htm";
                     $obPayment->errMsg = $obreceipt->m_sendOrderDetails();
                     break;
                 case "status":
                     $retUrl = $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=checkout.status&mode=" . $this->request['mode']);
                     $_SESSION['referer'] = $retUrl;
                     if ((!isset($_SESSION['userid']) || !isset($_SESSION['username']) || $_SESSION['userid'] == "") && !isset($_SESSION['customer']) && !isset($_SESSION['email'])) {
                         $siteUrl = SITE_URL . "ecom/index.php?action=checkout.loginForm";
                         $this->libFunc->m_mosRedirect($this->libFunc->m_safeUrl($siteUrl));
                     }
                     unset($_SESSION['referer']);
                     $obreceipt->template = $this->templatePath . "orderProcessed.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href='#'>Order Processed</a>");
                     $this->obTpl->set_var("TPL_VAR_BODY", $obreceipt->m_orderProcessed());
                     break;
                 case "receipt":
                     $retUrl = $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=checkout.receipt&mode=" . $this->request['mode']);
                     $_SESSION['referer'] = $retUrl;
                     if ((!isset($_SESSION['userid']) || !isset($_SESSION['username']) || $_SESSION['userid'] == "") && !isset($_SESSION['customer']) && !isset($_SESSION['email'])) {
                         $siteUrl = SITE_URL . "ecom/index.php?action=checkout.loginForm";
                         $this->libFunc->m_mosRedirect($this->libFunc->m_safeUrl($siteUrl));
                     }
                     //$this->libFunc->m_cartAuthenticate();
                     unset($_SESSION['referer']);
                     $obreceipt->receiptTemplate = $this->templatePath . "receipt.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href='#'>View Receipt</a>");
                     $this->obTpl->set_var("TPL_VAR_BODY", $obreceipt->m_dspreceipt());
                     break;
                 case "editOrder":
                     if ((!isset($_SESSION['userid']) || !isset($_SESSION['username']) || $_SESSION['userid'] == "") && !isset($_SESSION['customer']) && !isset($_SESSION['email'])) {
                         $siteUrl = SITE_URL . "ecom/index.php?action=checkout.loginForm";
                         $this->libFunc->m_mosRedirect($this->libFunc->m_safeUrl($siteUrl));
                     }
                     $obShopDb = new c_shopDb();
                     $obShopDb->obTpl = $this->obTpl;
                     $obShopDb->obDb = $this->obDb;
                     $obShopDb->request = $this->request;
                     $obShopDb->m_addInvoiceToCart();
                     $cartUrl = $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=ecom.viewcart");
                     $this->libFunc->m_mosRedirect($cartUrl);
                     break;
                 case "cardsave_success":
                     if ($_REQUEST['StatusCode'] != '0') {
                         $_SESSION['Message'] = $_REQUEST['Message'];
                         $retUrl = SITE_URL . "ecom/index.php?action=checkout.billing";
                         $this->libFunc->m_mosRedirect($this->libFunc->m_safeUrl($retUrl));
                         exit;
                     }
                     $vAuthCode = $_SESSION['vAuthCode'] = str_replace("AuthCode: ", "", $_REQUEST['Message']);
                     if ($vAuthCode) {
                         $this->obDb->query = "update " . ORDERS . " set vAuthCode='{$vAuthCode}' where iOrderid_PK=" . $_REQUEST['OrderID'];
                         $this->obDb->updateQuery();
                     }
                     $obCSR->receiptTemplate = $this->templatePath . "cardsave_success.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href='#'>Cardsave Success</a>");
                     $retUrl = SITE_URL . "ecom/index.php?action=checkout.process&mode=" . $_REQUEST['OrderID'];
                     $this->obDb->query = "update " . ORDERS . " set iOrderStatus=1 where iOrderid_PK=" . $_REQUEST['OrderID'];
                     $this->obDb->updateQuery();
                     $this->libFunc->m_mosRedirect($this->libFunc->m_safeUrl($retUrl));
                     break;
                 case "backorder":
                     $obreceipt->m_processBackorder();
                     break;
                 case "supplierConf":
                     $obreceipt->receiptTemplate = $this->templatePath . "supplier_conf.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href='#'>Confirmation</a>");
                     $this->obTpl->set_var("TPL_VAR_BODY", $obreceipt->m_supplierOrderConf());
                     break;
                 default:
                     $this->comFunc->m_checkShoppingCart();
                     $retUrl = $this->libFunc->m_safeUrl(SITE_SAFEURL . "ecom/index.php?action=checkout.billing");
                     $_SESSION['referer'] = $retUrl;
                     if (!isset($this->request['email']) && empty($this->request['email'])) {
                         $this->libFunc->m_cartAuthenticate();
                         unset($_SESSION['referer']);
                     } elseif ($obBill->m_valiadateEmail() == 1) {
                         $obBill->loginTemplate = $this->templatePath . "checkoutLogin.tpl.htm";
                         $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href='#'>Login</a>");
                         $this->obTpl->set_var("TPL_VAR_BODY", $obBill->m_checkoutLoginForm());
                         break;
                     }
                     $obBill->billShipTemplate = $this->templatePath . "ConfirmOrderAndBillShip.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href='#'>Shopping basket</a>");
                     $this->obTpl->set_var("TPL_VAR_BODY", $obBill->m_billShipInfoForm());
                     break;
             }
             break;
         case "wishlist":
             if (USEWISHLIST != 1) {
                 $retUrl = $this->libFunc->m_safeUrl(SITE_URL . "index.php?action=error&mode=content");
                 header("Location:" . $retUrl);
                 exit;
             }
             $obWishInterface = new c_wishInterface();
             $obWishInterface->obTpl = $this->obTpl;
             $obWishInterface->obDb = $this->obDb;
             $obWishInterface->request = $this->request;
             $obWishlistDb = new c_wishlistDb();
             $obWishlistDb->obTpl = $this->obTpl;
             $obWishlistDb->obDb = $this->obDb;
             $obWishlistDb->request = $this->request;
             $this->libFunc = new c_libFunctions();
             switch ($action[1]) {
                 case "display":
                     $retUrl = $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=wishlist.display");
                     $_SESSION['referer'] = $retUrl;
                     $this->libFunc->authenticate();
                     unset($_SESSION['referer']);
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href='#'>My Wish List</a>");
                     $obWishInterface->template = $this->templatePath . "wishlist.tpl.htm";
                     $obWishInterface->libFunc = $this->libFunc;
                     $this->obTpl->set_var("TPL_VAR_BODY", $obWishInterface->m_showWishlist());
                     break;
                 case "add":
                     $retUrl = $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=wishlist.add&mode=" . $this->request['mode']);
                     $_SESSION['referer'] = $retUrl;
                     $this->libFunc->authenticate();
                     unset($_SESSION['referer']);
                     $this->libFunc->authenticate();
                     $obWishlistDb->m_insertWishlist();
                     break;
                 case "emailadd":
                     $this->libFunc->authenticate();
                     $obWishlistDb->m_addWishEmail();
                     break;
                 case "emailsend":
                     $this->libFunc->authenticate();
                     $obWishInterface->m_sendEmail();
                     break;
                 case "emailremove":
                     $this->libFunc->authenticate();
                     $obWishlistDb->m_removeWishEmail();
                     break;
                 case "modify":
                     $this->libFunc->authenticate();
                     $obWishlistDb->m_modifyWishlist();
                     break;
                 default:
                     $this->libFunc->authenticate();
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href='#'>My wishlist</a>");
                     $obWishInterface->template = $this->templatePath . "wishlist.tpl.htm";
                     $obWishInterface->libFunc = $this->libFunc;
                     $this->obTpl->set_var("TPL_VAR_BODY", $obWishInterface->m_showWishlist());
                     break;
             }
             break;
         case "compare":
             if (USECOMPARE != 1) {
                 $retUrl = $this->libFunc->m_safeUrl(SITE_URL . "index.php");
                 header("Location:" . $retUrl);
                 exit;
             }
             $obCompareInterface = new c_compareInterface();
             $obCompareInterface->obTpl = $this->obTpl;
             $obCompareInterface->obDb = $this->obDb;
             $obCompareInterface->request = $this->request;
             $obCompareDb = new c_comparelistDb();
             $obCompareDb->obTpl = $this->obTpl;
             $obCompareDb->obDb = $this->obDb;
             $obCompareDb->request = $this->request;
             $this->libFunc = new c_libFunctions();
             switch ($action[1]) {
                 case "display":
                     $retUrl = $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=compare.display");
                     $_SESSION['referer'] = $retUrl;
                     $this->libFunc->authenticate();
                     unset($_SESSION['referer']);
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href='#'>My Comparison List</a>");
                     $obCompareInterface->template = $this->templatePath . "comparelist.tpl.htm";
                     $obCompareInterface->libFunc = $this->libFunc;
                     $this->obTpl->set_var("TPL_VAR_BODY", $obCompareInterface->m_showComparelist());
                     break;
                 case "add":
                     $retUrl = $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=compare.add&mode=" . $this->request['mode']);
                     $_SESSION['referer'] = $retUrl;
                     $this->libFunc->authenticate();
                     unset($_SESSION['referer']);
                     $this->libFunc->authenticate();
                     $obCompareDb->m_insertComparelist();
                     break;
                 case "modify":
                     $this->libFunc->authenticate();
                     $obCompareDb->m_modifyComparelist();
                     break;
                 default:
                     $this->libFunc->authenticate();
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href='#'>My Comaparison list</a>");
                     $obCompareInterface->template = $this->templatePath . "comparelist.tpl.htm";
                     $obCompareInterface->libFunc = $this->libFunc;
                     $this->obTpl->set_var("TPL_VAR_BODY", $obCompareInterface->m_showComparelist());
                     break;
             }
             break;
         case "enquiry":
         case "wishlist":
             $obEnquiryInterface = new c_enquiryInterface();
             $obEnquiryInterface->obTpl = $this->obTpl;
             $obEnquiryInterface->obDb = $this->obDb;
             $obEnquiryInterface->request = $this->request;
             $obEnquiryDb = new c_enquiryDb();
             $obEnquiryDb->obTpl = $this->obTpl;
             $obEnquiryDb->obDb = $this->obDb;
             $obEnquiryDb->request = $this->request;
             $this->libFunc = new c_libFunctions();
             switch ($action[1]) {
                 case "dspForm":
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href='#'>Product Enquiry</a>");
                     $obEnquiryInterface->enquiryTemplate = $this->templatePath . "enquiry.tpl.htm";
                     $obEnquiryInterface->libFunc = $this->libFunc;
                     $this->obTpl->set_var("TPL_VAR_BODY", $obEnquiryInterface->m_showEnquiryForm());
                     break;
                 case "post":
                     $obEnquiryInterface->m_sendEmail();
                     break;
                 case "status":
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href='#'>Product Enquiry</a>");
                     $obEnquiryInterface->enquiryTemplate = $this->templatePath . "enquirySubmit.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BODY", $obEnquiryInterface->m_showStatus());
                     break;
                 default:
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href='#'>Product Enquiry</a>");
                     $obEnquiryInterface->enquiryTemplate = $this->templatePath . "enquiry.tpl.htm";
                     $obEnquiryInterface->libFunc = $this->libFunc;
                     $this->obTpl->set_var("TPL_VAR_BODY", $obEnquiryInterface->m_showEnquiryForm());
                     break;
             }
             break;
         default:
             $retUrl = $this->libFunc->m_safeUrl(SITE_URL . "index.php");
             header("Location:" . $retUrl);
             exit;
             break;
     }
 }