﻿//common functions

// Replaces all instances of the given substring.
String.prototype.replaceAll = function( 
    strTarget, // The substring you want to replace
    strSubString // The string you want to replace in.
    ){
        var strText = this;
        var intIndexOfMatch = strText.indexOf( strTarget );
         
        // Keep looping while an instance of the target string
        // still exists in the string.
        while (intIndexOfMatch != -1){
            // Relace out the current instance.
            strText = strText.replace( strTarget, strSubString )
             
            // Get the index of any next matching substring.
            intIndexOfMatch = strText.indexOf( strTarget );
        }
         
        // Return the updated string with ALL the target strings
        // replaced out with the new substring.
        return( strText );
}

function confirmSubmit(msg) {
    if (confirm(msg)==true) {
        return true;
    } else {
        return false;
    }
}

function getObject(obj) {
  if(document.all) {
    if(typeof obj=="string") {
      return document.all(obj);
    } else {
      return obj.style;
    }
  }
  if(document.getElementById) {
    if(typeof obj=="string") {
      return document.getElementById(obj);
    } else {
      return obj.style;
    }
  }
  return null;
}

function showHide(showDiv, hideDiv) {
    getObject(showDiv).style.display = "inline";
    getObject(hideDiv).style.display = "none";
}

function onKeyPressNumericOnly(e) {
    e = e || window.event;
    var code = e.charCode || e.keyCode;

    if ((code > 47) && (code < 58)) {

        return true;
    }

    return false;
}

function showTerms() {
   termswindow = window.open('http://www.tcswarehouse.com/terms/terms-and-conditions-popup.aspx',
       'termswindow','location=0,status=1,scrollbars=1,width=500,height=600');
   termswindow.moveTo(100,100);
   termswindow.focus();
}

function showMap() {
   mapwindow = window.open('http://www.tcswarehouse.com/customer-services/how-to-find-us-popup.aspx',
       'mapwindow','location=0,status=1,scrollbars=1,width=500,height=600');
   mapwindow.moveTo(100,100);
   mapwindow.focus();
}

// Hide email: holding page
function zPpTviDcmNJyNNb()
{
var cxtQnoHHdswRMjA=["x73","97","108","101","x73","64","116","x63","x73","x77","x61","x72","x65","104","111","x75","115","x65","x2e","99","x6f","x6d"];
var ktvZlfzEpvLPoVQ=[""];
var DkLisXsjlxWFRLN=["x73","97","108","101","x73","64","116","99","115","x77","x61","114","x65","104","111","117","115","101","x2e","99","111","x6d"];
document.write(" Email <a href=\"&#x6d;&#97;&#105;&#x6c;&#000116;&#x6f;&#x3a;");
for (i=0; i<cxtQnoHHdswRMjA.length; i++) document.write('&#'+cxtQnoHHdswRMjA[i]+';');
for (i=0; i<ktvZlfzEpvLPoVQ.length; i++) document.write(ktvZlfzEpvLPoVQ[i]);
document.write('" >');
for (i=0; i<DkLisXsjlxWFRLN.length; i++) document.write('&#'+DkLisXsjlxWFRLN[i]+';');
document.write('</a>. ');
}

//Hide sales
function gObQdKFTTFyMabH()
{
var HqVRXDZRqIVHdzK=["115","x61","108","101","115","x40","116","x63","115","119","97","x72","101","x68","111","x75","x73","101","x2e","99","x6f","109"];
var FDJxLyaFxVzLPYu=[""];
var nInOvneZLOGbwPC=["x73","97","108","x65","115","64","116","99","115","x77","x61","114","x65","104","x6f","x75","x73","101","46","99","111","109"];
document.write("<a href=\"&#x6d;&#x61;&#x69;&#108;&#116;&#x6f;&#x3a;");
for (i=0; i<HqVRXDZRqIVHdzK.length; i++) document.write('&#'+HqVRXDZRqIVHdzK[i]+';');
for (i=0; i<FDJxLyaFxVzLPYu.length; i++) document.write(FDJxLyaFxVzLPYu[i]);
document.write('" >');
for (i=0; i<nInOvneZLOGbwPC.length; i++) document.write('&#'+nInOvneZLOGbwPC[i]+';');
document.write('</a>');
}

//Hide accounts
function bKBfAnTseZetsrG()
{
var fUJAHbIilrttdQt=["x61","99","99","111","117","110","x74","115","64","x74","99","x73","119","97","x72","x65","104","111","117","115","101","46","x63","111","x6d"];
var eXqudIVYDeWkKBS=[""];
var WCSOEHKvAKlfNlT=["97","99","99","x6f","117","x6e","116","x73","x40","x74","99","115","x77","97","114","x65","104","111","x75","115","x65","46","x63","x6f","109"];
document.write("<a href=\"&#x6d;&#x61;&#105;&#000108;&#x74;&#000111;&#00058;");
for (i=0; i<fUJAHbIilrttdQt.length; i++) document.write('&#'+fUJAHbIilrttdQt[i]+';');
for (i=0; i<eXqudIVYDeWkKBS.length; i++) document.write(eXqudIVYDeWkKBS[i]);
document.write('" >');
for (i=0; i<WCSOEHKvAKlfNlT.length; i++) document.write('&#'+WCSOEHKvAKlfNlT[i]+';');
document.write('</a>');
}

//Hide tech
function skQxqgXBAOYwlKC()
{
var ibAlWTgRlgsMKYw=["116","101","99","x68","x40","x74","99","x73","119","x61","x72","101","x68","111","x75","x73","101","x2e","x63","111","109"];
var FsRTXgfoSumlXTv=[""];
var HdaYOhHLECRGWLL=["116","x65","x63","x68","x40","x74","x63","x73","119","x61","x72","x65","x68","111","x75","x73","x65","x2e","99","111","109"];
document.write("<a href=\"&#x6d;&#x61;&#105;&#108;&#x74;&#x6f;&#x3a;");
for (i=0; i<ibAlWTgRlgsMKYw.length; i++) document.write('&#'+ibAlWTgRlgsMKYw[i]+';');
for (i=0; i<FsRTXgfoSumlXTv.length; i++) document.write(FsRTXgfoSumlXTv[i]);
document.write('" >');
for (i=0; i<HdaYOhHLECRGWLL.length; i++) document.write('&#'+HdaYOhHLECRGWLL[i]+';');
document.write('</a>');
}
