
var CONST_HELP_URL = "http://www.cargosmart.com/onlinehelp/CustomerHelp/FlashHelp/CargoSmartOnlineHelp.htm";
var CONST_CF_HELP_URL = "http://www.cargosmart.com/onlinehelp/CarrierHelp/FlashHelp/CargoSmartOnlineHelp.htm";
var pdfWindow;
var partnership_instance = 0;
var user_instance = 0;
var abackstroke = 47;
var bkg_instance = 0;
var pf_sc_instance = 0;
var pr_sc_instance = 0;
var rpt_templ_instance = 0;
var si_instance = 0;
var si_templ_instance = 0;
var si_draft_instance = 0;
var screen_ht = screen.availHeight;
var screen_wd = screen.availWidth;
var screen_left = 0; 
var screen_top = 10;

//var last_mod_date_tou = ""
var last_mod_date_pss = ".";
var last_mod_ver_pss = "";
var last_mod_date_tou_format = "17 February 2008";
var last_mod_date_pss_format = "17 February 2008";
var legal_year = "2000 - 2009";
var last_mod_date_tou = " ";
//var last_mod_date_pss = " (last updated March 2004)."
FULL = "toolbar,directories,resizable,status,scrollbars,menubar,location,";
NONE = "scrollbars,resizable,status,";
MENUONLY = "menubar,scrollbars,resizable,status,";
ALL = "";
serverurl = "http://www.cargosmart.com/";
contenturl = "http://www.cargosmart.com/";
publicurl = "http://www.cargosmart.com/";
appurl = "http://app2.cargosmart.com/cs/";
appservlet = "http://app2.cargosmart.com/cs/servlet/icss";
appSSLservlet = "https://app1.cargosmart.com/cmf/servlet/icss";
appMCIservlet = "https://app3.cargosmart.com/mci/servlet/icss";
cnserverurl = "http://www.cargosmart.cn/";
appdomain = "; domain=.cargosmart.com";
TOUURL = contenturl + "about/terms_of_use.htm";
COPYURL = contenturl + "about/terms_of_use.htm#Section5";
PSSURL = contenturl + "about/privacy_policy.htm";
EXITURL = contenturl + "exit.htm";
var_submit_win = "navigation.submit_win";
var_work_id = "navigation.workId";
var_action = "navigation.action";
var_task_id = "navigation.taskId";
var_cache_id = "navigation.cacheId";
var_new_task = "navigation.newTask";
var_ssl = "navigation.ssl";
var_get_page = "getPage";
var_proceed = true;
var_cs2_domain = "cargosmart.com";

function setFocus(theFormName, theEleName) {
    document.forms[theFormName].elements[theEleName].focus();
}
function setSerialNo(from) {
    wn = self.name;
    sn = from + wn.substring(7);
    return sn;
}
function turnOn(imageName) {
    if (document.images) {
        document[imageName].src = eval(imageName + "on.src");
    }
}
function turnOff(imageName) {
    if (document.images) {
        document[imageName].src = eval(imageName + "off.src");
    }
}
function spacer(w, imagepath) {
    document.writeln("<img src='" + imagepath + "spacer.gif' width='" + w + "' HEIGHT='1'>");
}
function popup(url) {
    popupWin = window.open(url + "?getPage=popup.jsp" + "&" + var_ssl + "=" + isSSL(url), "popup", "width=400,height=240,left=300,top=300");
}
function popupPage(url, winsize, winname, winparms) {
    if (winsize == "S") {
        scalar = 0.33;
    } else {
        if (winsize == "M") {
            scalar = 0.5;
        } else {
            if (winsize == "L") {
                scalar = 0.75;
            } else {
                scalar = 0.9;
            }
        }
    }
    w_ht = Math.round(scalar * screen_ht);
    w_wd = Math.round(scalar * screen_wd);
    w_left = (screen_wd - w_wd) - 20;
    winparms += "left=" + w_left + ",top=" + screen_top + ",screenX=" + w_left + ",screenY=" + screen_top + ",";
    winparms += "height=" + w_ht + ",width=" + w_wd;
    if (window.noncsWin) {
        if (!noncsWin.closed) {
            noncsWin.close();
        }
    }
    noncsWin = windowManagement_openWindow(url, winname, winparms);
    return;
}
function popupTOU() {
    popupPage(TOUURL, "L", "cslegal", NONE);
}
function popupCopyRight() {
    popupPage(COPYURL, "L", "cslegal", NONE);
}
function popupPSS() {
    popupPage(PSSURL, "L", "cslegal", NONE);
}
function popupExit(url) {
    w_top = Math.round((screen_ht - 300) * 0.5);
    w_left = Math.round((screen_wd - 460) * 0.5);
    winparms = "width=460,height=200,";
    winparms += "left=" + w_left + ",top=" + w_top;
    exitWin = window.open(contenturl + "exit.htm", "popup", winparms);
    popupPage(url, "X", "noncs", FULL);
    exitWin.focus();
}
function openPage(page) {
    if (page == "sign_in") {
        page = "hp_public";
    } else {
        if (page == "register") {
            page = "pf_register";
        } else {
            if (page == "forget_pwd") {
                page = "pf_forget_pwd";
            } else {
                if (page == "track_cargo") {
                    page = "ct_criteria_p";
                } else {
                    if (page == "contact") {
                        page = "mi_contact_us_p";
                    } else {
                        page = "hp_" + page;
                    }
                }
            }
        }
    }
    document.frmSubmit.elements["getPage"].value = page + ".jsp";
    document.frmSubmit.elements[var_ssl].value = isSSL(location.protocol);
}
function getSignOffPage() {
    document.frm_sign_off.elements[var_work_id].value = "GetSignOffWork";
    document.frm_sign_off.elements[var_action].value = "forward";
    document.frm_sign_off.elements[var_task_id].value = "GetSignOffTask";
    document.frm_sign_off.elements[var_cache_id].value = "sys_sign_off";
    document.frm_sign_off.elements[var_new_task].value = true;
    document.frm_sign_off.elements[var_get_page].value = "sys_sign_off.jsp";
    document.frm_sign_off.target = "cargosmart";
    document.frm_sign_off.method = "post";
    document.frm_sign_off.submit();
}
function cfgetSignOffPage() {
    document.frm_sign_off.elements[var_work_id].value = "GetSignOffWork";
    document.frm_sign_off.elements[var_action].value = "forward";
    document.frm_sign_off.elements[var_task_id].value = "GetSignOffTask";
    document.frm_sign_off.elements[var_cache_id].value = "sys_sign_off";
    document.frm_sign_off.elements[var_new_task].value = true;
    document.frm_sign_off.elements[var_get_page].value = "cf_sys_sign_off.jsp";
    document.frm_sign_off.target = "csc_cargosmart";
    document.frm_sign_off.method = "post";
    document.frm_sign_off.submit();
}
function getHomePage() {
    document.frm_header_footer.elements[var_work_id].value = "GetHomePageWork";
    document.frm_header_footer.elements[var_action].value = "forward";
    document.frm_header_footer.elements[var_task_id].value = "GetHomePageTask";
    document.frm_header_footer.elements[var_cache_id].value = "footer_all";
    document.frm_header_footer.elements[var_new_task].value = true;
    return true;
}
function getIUHomePage() {
    document.i_frm_header_footer.elements[var_work_id].value = "IUGetHomePageWork";
    document.i_frm_header_footer.elements[var_action].value = "forward";
    document.i_frm_header_footer.elements[var_task_id].value = "IUGetHomePageTask";
    document.i_frm_header_footer.elements[var_cache_id].value = "iu_header_primary";
    document.i_frm_header_footer.elements[var_new_task].value = true;
    return true;
}
function getContactUs() {
    document.frm_header_footer.elements["hdr.ref_page"].value = document.title;
    document.frm_header_footer.elements[var_work_id].value = "ContactUsWork";
    document.frm_header_footer.elements[var_action].value = "forward";
    document.frm_header_footer.elements[var_task_id].value = "ContactUsTask";
    document.frm_header_footer.elements[var_new_task].value = true;
    document.frm_header_footer.elements[var_cache_id].value = "mi_help";
    return true;
}
function getContactUsForChgPwd() {
    document.frm_header_footer.elements["hdr.ref_page"].value = document.title;
    document.frm_header_footer.elements[var_work_id].value = "ContactUsWork";
    document.frm_header_footer.elements[var_action].value = "forward";
    document.frm_header_footer.elements[var_task_id].value = "ContactUsTask";
    document.frm_header_footer.elements[var_cache_id].value = "footer_changepassword";
    document.frm_header_footer.elements[var_new_task].value = true;
    return true;
}
function getContactUsForAll() {
    document.frm_header_footer.elements["hdr.ref_page"].value = document.title;
    document.frm_header_footer.elements[var_work_id].value = "ContactUsWork";
    document.frm_header_footer.elements[var_action].value = "forward";
    document.frm_header_footer.elements[var_task_id].value = "ContactUsTask";
    document.frm_header_footer.elements[var_cache_id].value = "footer_all";
    document.frm_header_footer.elements[var_new_task].value = true;
    return true;
}
function getPublicContactUs() {
    document.frm_header_footer.elements["hdr.ref_page"].value = document.title;
    document.frm_header_footer.elements[var_work_id].value = "ContactUsPublicWork";
    document.frm_header_footer.elements[var_action].value = "forward";
    document.frm_header_footer.elements[var_task_id].value = "ContactUsPublicTask";
    document.frm_header_footer.elements[var_new_task].value = true;
    return true;
}
function getHelp() {
    var astr = "getPage=mi_help.jsp&hdr.ref_page=" + document.title + "&" + var_ssl + "=" + isSSL(location.protocol);
    return astr;
}
function getCFHelp() {
    var astr = "getPage=mi_help.jsp&hdr.ref_page=" + document.title + "&hdr.forCarrierUser=1&" + var_ssl + "=" + isSSL(location.protocol);
    return astr;
}
function getIUHelp() {
    var astr = "getPage=mi_help.jsp&hdr.ref_page=" + document.title + "&" + var_ssl + "=" + isSSL(location.protocol);
    return astr;
}
function getCarrierContactUs() {
    document.frm_header_footer.elements[var_work_id].value = "CarrierContactUsWork";
    document.frm_header_footer.elements[var_action].value = "forward";
    document.frm_header_footer.elements[var_task_id].value = "CarrierContactUsTask";
    document.frm_header_footer.elements[var_new_task].value = true;
    document.frm_header_footer.elements[var_cache_id].value = "cf_contact_us";
    return true;
}
function isSSL(url) {
    if (url.indexOf("http") == -1) {
        return isSSL(location.protocol);
    }
    if (url.indexOf("https") == -1) {
        return false;
    } else {
        return true;
    }
}
function submitClickSmallWinCenter(newWin, windowName, winsize, url, form, method, para) {
    if (var_proceed) {
        var_proceed = false;
        windownames = getWindowName(windowName);
        winsize = winsize.toUpperCase();
        if (winsize == "S") {
            scalar = 0.33;
        } else {
            if (winsize == "M") {
                scalar = 0.5;
            } else {
                if (winsize == "L") {
                    scalar = 0.75;
                } else {
                    scalar = 0.9;
                }
            }
        }
        w_ht = Math.round(scalar * screen_ht);
        w_wd = Math.round(scalar * screen_wd);
        w_left = Math.round((screen_wd - w_wd) * 0.5);
        w_top = Math.round((screen_ht - w_ht) * 0.5);
        windowparms = "resizable=yes,status=yes,scrollbars=yes,";
        windowparms += "left=" + w_left + ",top=" + w_top + ",screenX=" + w_left + ",screenY=" + w_top + ",";
        windowparms += "height=" + w_ht + ",width=" + w_wd;
        if (method == "get") {
            para = var_submit_win + "=" + escape(windownames) + "&" + para + "&" + var_ssl + "=" + isSSL(url);
            if (newWin == true) {
                var_proceed = false;
                if ((newWindow = windowManagement_openWindow(url + "?" + para, windowName, windowparms)) == null) {
                    var_proceed = true;
                    return;
                }
                var_proceed = true;
            } else {
                window.location.href = url + "?" + para;
            }
        } else {
            if (method == "post") {
                //form.action = url
                form.method = method;
                if (form.elements[var_submit_win] != null) {
                    form.elements[var_submit_win].value = escape(windownames);
                }
                if (form.elements[var_ssl] != null) {
                    form.elements[var_ssl].value = isSSL(form.action);
                }
                if (newWin == true) {
                    var_proceed = false;
                    if ((newWindow = windowManagement_openWindow("cs.htm", windowName, windowparms)) == null) {
                        var_proceed = true;
                        return;
                    }
                    form.target = windowName;
                    form.submit();
                    var_proceed = true;
                } else {
                    form.target = "_self";
                    form.submit();
                }
            } else {
                return;
            }
        }
    } else {
        alert("Please wait while processing...");
    }
}
function submitClickSmallWin(newWin, windowName, winsize, url, form, method, para) {
    if (var_proceed) {
        var_proceed = false;
        windownames = getWindowName(windowName);
        winsize = winsize.toUpperCase();
        if (winsize == "S") {
            scalar = 0.33;
        } else {
            if (winsize == "M") {
                scalar = 0.5;
            } else {
                if (winsize == "L") {
                    scalar = 0.75;
                } else {
                    scalar = 0.9;
                }
            }
        }
        w_ht = Math.round(scalar * screen_ht);
        w_wd = Math.round(scalar * screen_wd);
        w_left = (screen_wd - w_wd) - 20;
        windowparms = "resizable=yes,status=yes,scrollbars=yes,";
        windowparms += "left=" + w_left + ",top=" + screen_top + ",screenX=" + w_left + ",screenY=" + screen_top + ",";
        windowparms += "height=" + w_ht + ",width=" + w_wd;
        if (method == "get") {
            para = var_submit_win + "=" + escape(windownames) + "&" + para + "&" + var_ssl + "=" + isSSL(url);
            if (newWin == true) {
                var_proceed = false;
                if ((newWindow = windowManagement_openWindow(url + "?" + para, windowName, windowparms)) == null) {
                    var_proceed = true;
                    return;
                }
                var_proceed = true;
            } else {
                window.location.href = url + "?" + para;
            }
        } else {
            if (method == "post") {
                //form.action = url
                form.method = method;
                if (form.elements[var_submit_win] != null) {
                    form.elements[var_submit_win].value = escape(windownames);
                }
                if (form.elements[var_ssl] != null) {
                    form.elements[var_ssl].value = isSSL(form.action);
                }
                if (newWin == true) {
                    var_proceed = false;
                    if ((newWindow = windowManagement_openWindow("cs.htm", windowName, windowparms)) == null) {
                        var_proceed = true;
                        return;
                    }
                    form.target = windowName;
                    form.submit();
                    var_proceed = true;
                } else {
                    form.target = "_self";
                    form.submit();
                }
            } else {
                return;
            }
        }
    } else {
        alert("Please wait while processing...");
    }
}
function submitClickRefresh(newWin, windowName, windowType, url, form, method, para) {
    windownames = getWindowName(windowName);
    var w_ht = screen_ht - 60;
    var w_wd = screen_wd - 20;
    windowType += "left=10,top=10,screenX=10,screenY=10,";
    windowType += "height=" + w_ht + ",width=" + w_wd;
    if (method == "get") {
        para = var_submit_win + "=" + escape(windownames) + "&" + para + "&" + var_ssl + "=" + isSSL(url);
        if (newWin == true) {
            if ((newWindow = windowManagement_openWindow(url + "?" + para, windowName, windowType)) == null) {
                return;
            }
        } else {
            window.location.href = url + "?" + para;
        }
    } else {
        if (method == "post") {
                //form.action = url
            form.method = method;
            if (form.elements[var_submit_win] != null) {
                form.elements[var_submit_win].value = escape(windownames);
            }
            if (form.elements[var_ssl] != null) {
                form.elements[var_ssl].value = isSSL(form.action);
            }
            if (newWin == true) {
                if ((newWindow = windowManagement_openWindow("cs.htm", windowName, windowType)) == null) {
                    return;
                }
                form.target = windowName;
            } else {
                form.target = "_self";
            }
            form.submit();
        } else {
            return;
        }
    }
}
function submitClick(newWin, windowName, windowType, url, form, method, para) {
    if (var_proceed) {
        var_proceed = false;
        windownames = getWindowName(windowName);
        var w_ht = screen_ht - 60;
        var w_wd = screen_wd - 20;
        windowType += "left=10,top=10,screenX=10,screenY=10,";
        windowType += "height=" + w_ht + ",width=" + w_wd;
        if (method == "get") {
            para = var_submit_win + "=" + escape(windownames) + "&" + para + "&" + var_ssl + "=" + isSSL(url);
            if (newWin == true) {
                var_proceed = false;
                if ((newWindow = windowManagement_openWindow(url + "?" + para, windowName, windowType)) == null) {
                    var_proceed = true;
                    return;
                }
                var_proceed = true;
            } else {
                window.location.href = url + "?" + para;
            }
        } else {
            if (method == "post") {
                //form.action = url
                form.method = method;
                if (form.elements[var_submit_win] != null) {
                    form.elements[var_submit_win].value = escape(windownames);
                }
                if (form.elements[var_ssl] != null) {
                    form.elements[var_ssl].value = isSSL(form.action);
                }
                if (newWin == true) {
                    var_proceed = false;
                    if ((newWindow = windowManagement_openWindow("cs.htm", windowName, windowType)) == null) {
                        var_proceed = true;
                        return;
                    }
                    form.target = windowName;
                    form.submit();
                    var_proceed = true;
                } else {
                    form.target = "_self";
                    form.submit();
                }
            } else {
                return;
            }
        }
    } else {
        alert("Please wait while processing...");
    }
}
function pdfClick(newWin, windowName, windowType, url, form, method, para) {
    if (var_proceed) {
        var_proceed = false;
        windownames = getWindowName(windowName);
        var w_ht = screen_ht - 60;
        var w_wd = screen_wd - 20;
        windowType += "left=10,top=10,screenX=10,screenY=10,";
        windowType += "height=" + w_ht + ",width=" + w_wd;
        form.action = url;
        form.method = method;
        if (form.elements[var_submit_win] != null) {
            form.elements[var_submit_win].value = escape(windownames);
        }
        if (form.elements[var_ssl] != null) {
            form.elements[var_ssl].value = isSSL(form.action);
        }
        if (newWin == true) {
            if (pdfWindow && !pdfWindow.closed) {
                alert("Please close the pdf file before loading new pdf");
                        //pdfWindow.window.focus();
                return;
            } else {
                if ((pdfWindow = windowManagement_openWindow("cs.htm", windowName, windowType)) == null) {
                    return;
                }
                form.target = windowName;
            }
        } else {
            form.target = "_self";
        }
        form.submit();
    } else {
        alert("Please wait while processing...");
    }
}
function getWindowName(aWinName) {
    setMyCookie();//for the defect of confirm dialog disalbed the timeOut everyMinute()
    if (aWinName == "") {
        return escape("win" + self.name);
    } else {
        return escape("win" + aWinName);
    }
}
function generateTempId(windowname) {
    if (windowname.substring(0, 11) == "partnership") {
        partnership_instance++;
        return partnership_instance;
    } else {
        if (windowname.substring(0, 4) == "user") {
            user_instance++;
            return user_instance;
        } else {
            if (windowname.substring(0, 7) == "booking") {
                bkg_instance++;
                return bkg_instance;
            } else {
                if (windowname.substring(0, 5) == "pf_sc") {
                    pf_sc_instance++;
                    return pf_sc_instance;
                } else {
                    if (windowname.substring(0, 5) == "pr_sc") {
                        pr_sc_instance++;
                        return pr_sc_instance;
                    } else {
                        if (windowname.substring(0, 12) == "rpt_template") {
                            rpt_templ_instance++;
                            return rpt_templ_instance;
                        } else {
                            if (windowname.substring(0, 2) == "si") {
                                si_instance++;
                                return si_instance;
                            } else {
                                if (windowname.substring(0, 7) == "siTempl") {
                                    si_templ_instance++;
                                    return si_templ_instance;
                                } else {
                                    if (windowname.substring(0, 7) == "siDraft") {
                                        si_draft_instance++;
                                        return si_draft_instance;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
function getSelection(radio_button) {
    if (radio_button) {
        for (i = 0; i < radio_button.length; i++) {
            if (radio_button[i].checked) {
                selection = radio_button[i].value;
                return selection;
            }
        }
        return "";
    }
    return "";
}
function confirmCancel(WindowTitle) {
    location.href = contenturl + "errormessages/confirmcancel.htm?" + escape(WindowTitle);
}
function printPage() {
    if (navigator.appName == "Netscape" && navigator.appVersion.substring(0, 1) == "4") {
        alert("This function is not supported yet.  However, you can still print the current window by pressing \"Ctrl + P\".");
    } else {
        window.print();
    }
}
function setMyCookie() {
    var winnames = "win" + self.name;
        //document.cookie=  winnames+ "=" + escape(winnames) 
    everyMinute();
    self.focus();
}
function setSpecialCookie(aWinName) {
    var winnames = "win" + aWinName;
        //document.cookie= winnames + "=" + escape(winnames) 
    everyMinute();
    self.focus();
}
function addCookie(aWinName) {
    var todays_date = new Date();
    var expires_date = new Date(todays_date.getTime() + 20000); // 20 sec from now 
    document.cookie = aWinName + "=" + escape(aWinName) + "; expires=" + expires_date.toGMTString();
}
function deleteCookie(id) {
    var todays_date = new Date();
    var expires_date = new Date(todays_date.getTime() - 365 * 24 * 60 * 60000); // 1 year from now   
    document.cookie = id + "=; expires=" + expires_date.toGMTString();
}
function everyMinute() {
    addCookie("win" + self.name);
    setTimeout("everyMinute()", 15000);
}
function closeSelf() {
    deleteCookie("win" + self.name);
}
function resetCookies() {
    if (document.cookie != "") {
        thisCookie = document.cookie.split(";");
        todayDate = new Date();
        expireDate = new Date(todayDate.getTime() - 365 * 24 * 60 * 60000); // 1 year from now 
        for (i = 0; i < thisCookie.length; i++) {
            cookieName = thisCookie[i].split("=")[0];
            cookieValue = thisCookie[i].split("=")[1];
            if (cookieName.substring(0, 1) == " ") {
                aWin = (cookieName.substring(1, 4) == "win");
            } else {
                aWin = (cookieName.substring(0, 3) == "win");
            }
            if (aWin) {
                if ((cookieValue.substring(3) != self.name) && (cookieValue.substring(3) != "cargosmart")) {
                    document.cookie = cookieName + "=;expires=" + expireDate.toGMTString();
                }
            }
        }
    }
}
function openSample(url, windowname, winsize) {
    winsize = winsize.toUpperCase();
    if (winsize == "S") {
        scalar = 0.33;
    } else {
        if (winsize == "P") {
            scalar = 0.4;
        } else {
            if (winsize == "M") {
                scalar = 0.5;
            } else {
                scalar = 0.75;
            }
        }
    }
    w_ht = Math.round(scalar * screen_ht);
    w_wd = Math.round(scalar * screen_wd);
    w_left = (screen_wd - w_wd) - 20;
    windowparms = "resizable=yes,status=yes,scrollbars=yes,";
    windowparms += "left=" + w_left + ",top=" + screen_top + ",screenX=" + w_left + ",screenY=" + screen_top + ",";
    windowparms += "height=" + w_ht + ",width=" + w_wd;
    if (window.emailWindow) {
        if (!emailWindow.closed) {
            emailWindow.close();
        }
    }
    emailWindow = windowManagement_openWindow(contenturl + url, windowname, windowparms);
    return;
}
function w(astring) {
    document.writeln(astring);
}
function getValue(astring) {
    var temp = "";
    for (var i = 0; i < astring.length; i++) {
        target = astring.charAt(i);
        if ((target == " ") || (target == "=")) {
            target = "_";
        }
        if ((target == "+") || (target == "-")) {
            target = "_";
        }
        if ((target == "*") || (target == "/")) {
            target = "_";
        }
        if ((target == "(") || (target == ")")) {
            target = "_";
        }
        if ((target == "{") || (target == "}")) {
            target = "_";
        }
        if ((target == "[") || (target == "]")) {
            target = "_";
        }
        if ((target == "<") || (target == ">")) {
            target = "_";
        }
        if ((target == ":") || (target == ";")) {
            target = "_";
        }
        if ((target == "~") || (target == "`")) {
            target = "_";
        }
        if ((target == "!") || (target == "@")) {
            target = "_";
        }
        if ((target == "#") || (target == "$")) {
            target = "_";
        }
        if ((target == "%") || (target == "^")) {
            target = "_";
        }
        if ((target == "&") || (target == "*")) {
            target = "_";
        }
        if ((target == "|") || (target == "\\")) {
            target = "_";
        }
        if ((target == ".") || (target == ",")) {
            target = "_";
        }
        if ((target == "?") || (target == "'")) {
            target = "_";
        }
        if (target == "\"") {
            target = "_";
        }
        temp += target;
    }
    return temp;
}
function signoff(servleturl) {
    if (confirm("Are you sure you want to sign off?  If you sign off, all the windows for CargoSmart will be closed.")) {
        if (document.cookie != "") {
            thisCookie = document.cookie.split(";");
            for (i = 0; i < thisCookie.length; i++) {
                cookieName = thisCookie[i].split("=")[0];
                cookieValue = thisCookie[i].split("=")[1];
                if (cookieName.substring(0, 1) == " ") {
                    aWin = (cookieName.substring(1, 4) == "win");
                } else {
                    aWin = (cookieName.substring(0, 3) == "win");
                }
                if (aWin) {
                    if ((cookieValue.substring(3) != self.name) && (cookieValue.substring(3) != "cargosmart")) {
                        NewWindow = window.open("cs.htm", cookieValue.substring(3));
                        NewWindow.window.close();
                        deleteCookie(cookieName);
                    }
                }
            }
        }
        getSignOffPage();
        if (self.name != "cargosmart") {
            self.close();
        }
    }
}
function cfsignoff(servleturl) {
    if (confirm("Are you sure you want to sign off?  If you sign off, all the windows for CargoSmart will be closed.")) {
        if (document.cookie != "") {
            thisCookie = document.cookie.split(";");
            for (i = 0; i < thisCookie.length; i++) {
                cookieName = thisCookie[i].split("=")[0];
                cookieValue = thisCookie[i].split("=")[1];
                if (cookieName.substring(0, 1) == " ") {
                    aWin = (cookieName.substring(1, 4) == "win");
                } else {
                    aWin = (cookieName.substring(0, 3) == "win");
                }
                if (aWin) {
                    if ((cookieValue.substring(3) != self.name) && (cookieValue.substring(3) != "cargosmart")) {
                        NewWindow = window.open("cs.htm", cookieValue.substring(3));
                        NewWindow.window.close();
                        deleteCookie(cookieName);
                    }
                }
            }
        }
        cfgetSignOffPage();
        if (self.name != "csc_cargosmart") {
            self.close();
        }
    }
}

