function Get_Parm(name) {  // stolen from signing.asp
    var start = document.location.search.indexOf(name+"=");
    var len = start+name.length+1;
    if ((!start) && (name != document.location.search.substring(0,name.length))) return null;
    if (start == -1) return "";
    var end = document.location.search.indexOf("&",len);
    if (end == -1) end = document.location.search.length;
    return unescape(document.location.search.substring(len,end));
}
function getPid(){
  var iOut = -1;
  var rePathMatch = /[\/\\]{1}limited-liability-company[\/\\]{1}|[\/\\]{1}llc-faq[\/\\]{1}|[\/\\]{1}llc-glossary[\/\\]{1}/gi
  iOut = Get_Parm( "iProcess" )
  if ( iOut == "" ){
    iOut = String( document.location ).match( rePathMatch )? 2: "";
  }
  return iOut;
}
var sAAC_name = "AssignedAgent";
var sAAC_processIndex = 0;
var sAAC_campaignIndex = 1;
var sAAC_testIndex = 2;

var iAAC_TestAmanda = 4;

function setAssignedAgentCookie( iCampaign, iTest ){

  var dt = new Date();
  var iProcess = getPid(); //Get_Parm("iProcess");
  //var iProcess = 2;	//HARDWIRE FOR TEST PURPOSE
  var cookie = sAAC_name + "=" + iProcess + "|" + iCampaign + "|" + iTest;
  //if ( iProcess == 1 || iProcess == 2 ){
  if ( iProcess == 2 ){
    dt.setDate( dt.getDate() + 90 );
    cookie += ";expires=" + dt.toGMTString();
    cookie += ";path=/" + ""; //";domain=.legalzoom.com";
    document.cookie = cookie;
  }
}
function setAssignedAgentCookieAH(){
  setAssignedAgentCookie( 1, iAAC_TestAmanda )
}
function getAssignedAgentImage(){
  var reCookie = new RegExp( sAAC_name + "=[^;]+", "gim" );
  var sCookies = document.cookie;
  var sCookie = sCookies? sCookies.match( reCookie ): null;
  var saFields = null;
  var iProcess = -1;
  var iCampaign = -1;
  var iTest = -1;
  var sOut = "/img/support-number-8883818758.gif";
  if ( sCookie ){
    saFields = String( sCookie ).replace( new RegExp( sAAC_name + "=", "gim" ), "" ).split( "|" );
    if ( saFields.length > sAAC_testIndex ){
      iProcess = saFields[ sAAC_processIndex ];
      iCampaign = saFields[ sAAC_campaignIndex ];
      iTest = saFields[ sAAC_testIndex ];
      if ( iCampaign == 1 && iProcess == 2 ){
        switch ( iTest ){
          case '1':
            sOut = "/img/support-number-8883818758.gif"
            break;
          case '2':
            sOut = "/img/Control_Hands.JPG";
            break;
          case '3':
            sOut = "/img/Denny_Kim.JPG";
            break;
          case '4':
            sOut = "/img/support-number-8883818758-ah.gif";
            break;
        }
      }
    }
  }
  return sOut;
}
function replaceAssignedAgentImage(){
  var sImg = "<img title='Support Number (888)381-8758' style='border-right:medium none;border-top:medium none;border-left:medium none;border-bottom:medium none' alt='Support Number (888)381-8758' src='" + getAssignedAgentImage() + "'>";
  document.getElementById ( "CSPodWrap" ).innerHTML = sImg;
}
/*
function getAgentPod( iQ )
  dim cookie
  dim sImg
  dim sOut
  dim iVals
  dim iProcess
  dim iCampaign
  dim iTest
  sImg = "/img/support-number-8883818758.gif"
  cookie = request.cookies("AssignedAgent")
  iVals = split( cookie, "|" )
  if ( IsArray( ivals ) and UBound( iVals ) = 2 ) then
    iProcess = iVals( 0 )
    iCampaign = iVals( 1 )
    iTest = iVals( 2 )
    'if ( iCampaign = 1 and ( ( iProcess = 1 and iQ = 63 ) or ( iProcess = 2 and iQ = 27 ) ) ) then
    if ( iCampaign = 1 and ( iProcess = 2 and iQ = 27 ) ) ) then
      select case iTest
       case 1: '  control
        sImg = "support-number-8883818758.gif"
        break;
       case 2: '  hand
        sImg = "Control_Hands.JPG"
        break;
       case 3: '  test
        sImg = "Denny_Kim.JPG"
        break;
      end select
    end if
  end if
  sOut = "<IMG SRC='" & sImg & "' alt='Support Number (888)381-8758' title='Support Number (888)381-8758'>"
  ' only llc and inc
  getAgentPod = sOut
end function
*/
