<!-- CODE FOR EXIT ICONS (non-secure) -->


// eStara code
var wv_gstrWidth     = "430";
var wv_gstrHeight    = "378";
var wv_gstrUI        = "UI0001";
var wv_gstrNewWindow = "yes";
var wv_gstrHost      = "as00.estara.com";
var wv_host          = wv_gstrHost=="as00.estara.com" ? "" : wv_gstrHost; // Specify host if not production
var wv_gstrAccountID = "200106281295";
var wv_goWindow      = null;

function PTTbutton(left,top,template,image)
{
  var id = "RANDOMID" + (new Date()).getTime() + Math.round(Math.random()*1000000);
  var div  = '<DIV ID="' + id + '" STYLE="position:absolute; z-index:10; left:' + left + 'px; top:' + top + 'px;">';
      div += '<a href="javascript:webVoicePop(\'Template=' + template + '\');"><img src="' + image + '" border="0"></a>';
      div += '</DIV>';
  document.write(div);
}

function webCall()
{
  if (wv_goWindow==null || wv_goWindow.closed)
  {
    var wv_argscopy = arguments;
    wv_argscopy[wv_argscopy.length++] = "calltype=webcall";
    wv_goWindow = wv_start(wv_argscopy);
  }
}

function webCallBack()
{
  var wv_argscopy = arguments;
  wv_argscopy[wv_argscopy.length++] = "calltype=webcallback";
  wv_goWindow = wv_start(wv_argscopy);
}

function webVoicePop()
{
  var wv_argscopy = arguments;
  wv_argscopy[wv_argscopy.length++] = "calltype=webvoicepop";
  wv_start(wv_argscopy);
}

function webChatPop()
{
  var wv_argscopy = arguments;
	alert(arguments);
  wv_argscopy[wv_argscopy.length++] = "calltype=webchatpop";
  wv_argscopy[wv_argscopy.length++] = "wndname=_blank";
  wv_start(wv_argscopy);
}

function wv_start(a)
{
  var wv_wndname = "webVoiceWindow";
  var wv_referrer = escape(window.location);
  if (wv_referrer.length>350)
  {
    var wv_tmp  = (window.location).toString().indexOf("?");
    wv_referrer = wv_tmp>0 ? escape((window.location).toString().substring(0,wv_tmp)+"---TRUNCATED") : escape("UNAVAILABLE - URL IS TOO LONG");
    if (wv_referrer.length>350)
	{
	  wv_referrer = escape("UNAVAILABLE - URL IS TOO LONG");
	}
  }
  var wv_protocol = "https";
  var wv_newwindow = wv_gstrNewWindow;
  var wv_width = wv_gstrWidth;
  var wv_height = wv_gstrHeight;
  var wv_ui = wv_gstrUI;
  var wv_features = "";
  var wv_baseurl = "";
  var wv_accountid = wv_gstrAccountID;
  var wv_getRequest = "";
  for (var i=0 ; i<a.length ; i++)
  {
    var wv_Arg = a[i].toString();
    var wv_indexDelim = wv_Arg.indexOf("=");
    if (wv_indexDelim!=-1)
    {
      var Name = (wv_Arg.substring(0,wv_indexDelim)).toLowerCase();
      var Value = wv_Arg.substring(wv_indexDelim+1,wv_Arg.length);
      switch(Name)
      {
        case "wndname": wv_wndname = Value;
        break;
        case "referrer": wv_referrer = escape(Value);
        break;
        case "newwindow": wv_newwindow = Value;
        break;
        case "width": wv_width = Value;
        break;
        case "height": wv_height = Value;
        break;
        case "accountid": wv_accountid = Value;
        break;
        case "wv_ui": wv_ui = Value;
        break;
        case "features": wv_features = Value;
        break;
        case "baseurl": wv_baseurl = Value;
        break;
        default: wv_getRequest += "&" + Name + "=" + escape(Value);
        break;
      }
    }
    else
    {
      alert("ERROR: Invalid argument passed to webXXX() function - Arg" + i + " is missing '=' sign : " + wv_Arg );
      return null;
    }
  }

  if (wv_baseurl=="")  wv_baseurl  = wv_protocol + "://" + wv_gstrHost + "/UI/" + wv_ui + "/" + wv_ui + ".php";
  if (wv_features=="") wv_features = "width=" + wv_width + ",height=" + wv_height + ",menubar=no,toolbar=no,directories=no,scrollbars=no,status=no,left=0,top=0,resizable=no";
  wv_getRequest = wv_baseurl +
                  ( wv_baseurl.indexOf("?")==-1 ? "?" : "&" ) +
                  "donotcache=" + (new Date()).getTime() +
                  "&accountid=" + wv_accountid +
                  "&referrer="  + wv_referrer +
                  "" +
                  wv_getRequest;

  if (wv_newwindow!="yes")
  {
    window.location = wv_getRequest;
  }
  else
  {
    return window.open( wv_getRequest, wv_wndname, wv_features );
  }
}



// eStara's Hours of Operation code

   function isholiday(d) 
   {
       dd = d.getDate();
       dm = d.getMonth()+1;
       if (navigator.appName == "Microsoft Internet Explorer")            
          dy = d.getYear();
       else 
          dy = 1900 + d.getYear();
       cd = dm+"/"+dd+"/"+dy;
       for (i=0; i<holiday.length; i++) 
       {
          if (cd == holiday[i]) 
             return true;
       } 
       return false;
    }
     
    function isopen(d) 
    {
       dow = d.getDay(); // day of the week
       hod = d.getHours(); // hour of the day
       mph = d.getMinutes(); // minutes past the hour
      
       //alert("local time" + hod + ":" + mph);
       //alert("open from " + hh(workday[dow].open) + ":" + mm(workday[dow].open) + "to " + hh(workday[dow].close) + ":" + mm(workday[dow].close));
       //alert("timezoneoffset = " + d.getTimezoneOffset()/60);
       tzone_delta = local_timez - d.getTimezoneOffset()/60;  
      
       if (isholiday(d))
          dow = 7;
      
       if (eval(hh(workday[dow].close)) > eval(hh(workday[dow].open)))
       {
          //alert("normal");
          if (ge(hod,mph,hh(workday[dow].open),mm(workday[dow].open)) && lt(hod,mph,hh(workday[dow].close),mm(workday[dow].close)))
             return true;
          else 
             return false; 
       }
      
       //alert ("close: " + hh(workday[dow].close));
       //alert ("open: " + hh(workday[dow].open));
       if (eval(hh(workday[dow].close)) < eval(hh(workday[dow].open)))
       // when closing time is past midnight
       alert("reverse");
       {
          if (ge(hod,mph,hh(workday[dow].open),mm(workday[dow].open)) || lt(hod,mph,hh(workday[dow].close),mm(workday[dow].close)))
             return true;
          else
             return false;
       }
       return false; 
    }
     
    function hh(str)
    {
       hr = str.substring(0, str.indexOf(":"));
       return((hr != "") ? hr : str);
    }
     
    function mm(str)
    {
       mr = str.substring(str.indexOf(":")+1, str.length);
       return((mr != "") ? mr : str);
    }
     
    function lt(hp_par1, mp_par1, hp_par2, mp_par2)
    {
       //alert("checking if " + hp_par1 + ":" + mp_par1 + " is less then " + hp_par2 + ":" + mp_par2); 
       if (eval(hp_par1 - tzone_delta) < eval(hp_par2)) 
       {
          //alert("true");
          return true;
       }  
       
       if ((eval(hp_par1 - tzone_delta) == eval(hp_par2)) && (eval(mp_par1) < eval(mp_par2)))
       {
          //alert("true");
          return true;
       }
       //alert("false"); 
       return false;
    }
      
    function ge(hp_par1, mp_par1, hp_par2, mp_par2)
    {
       //alert("checking if " + hp_par1 + ":" + mp_par1 + " is greater or equal then " + hp_par2 + ":" + mp_par2); 
       //alert("tzone_delta = " + tzone_delta);
       if (eval(hp_par1 - tzone_delta) > eval(hp_par2)) 
       {
          //alert("true");
          return true;
       }
    
       if ((eval(hp_par1 - tzone_delta) == eval(hp_par2)) && (eval(mp_par1) >= eval(mp_par2)))
       {
          //alert("true");
          return true;
       }
       //alert("false"); 
       return false;
    }
        
    function bizhours(open, close) 
    {
       this.open = open;
       this.close = close;
    }
     
    // ********************************************************
    // ** SET UP THE PARAMETERS FOR TIME-OF-DAY PtT BUTTON  ***
    // ********************************************************

    // TDCT: if open, a window will open    
    function popClick2Talk() 
    {
       d = new Date();
     
       if (isopen(d))
       {
          // specify what customers will see during the hours of operation
	  // Replace with your code from http://webcare.estara.com
	  // ESCAPE interior ' characters like this: \'
          window.open('/C2Texit.jsp', 'errorpop', 'menubar=no,toolbar=no,directories=no,scrollbars=no,status=no,screenX=100,screenY=100,resizable=no,width=430,height=378');

       }
       else
       {
          // specify what customers will see during the off-hours
	  // TDCT: if closed, nothing will happen
       } 
    }  

    if (document.images) { workday = new Array(); } else { CreateArray(7,workday); }
    // adhere to 24 hour convention for hours of operation
    // to indicate unavailability of the agents, use (0,0)
    workday[0] = new bizhours("3:59","4:00");  // Sunday
    workday[1] = new bizhours("8:00","22:55");  // Monday
    workday[2] = new bizhours("8:00","22:55");  // Tuesday
    workday[3] = new bizhours("8:00","22:55");  // Wednesday
    workday[4] = new bizhours("8:00","22:55");  // Thursday
    workday[5] = new bizhours("8:00","22:55");  // Friday
    workday[6] = new bizhours("10:00","17:55");  // Saturday
    workday[7] = new bizhours("3:59","4:00");  //holidays

    if (document.images) { holiday = new Array(); } else { CreateArray(20,holiday); }
    // TDCT: mm/dd/yyyy
    holiday[0] = "5/23/2005";		// Victoria Day
    holiday[1] = "7/1/2005";		// Canada Day
    holiday[2] = "8/1/2005";		// Provincial Holiday
    holiday[3] = "9/5/2005";		// Labour Day
    holiday[4] = "10/10/2005";		// Thanksgiving
    holiday[5] = "11/11/2005";		// Remembrance Day
    holiday[6] = "12/25/2005";		// Christmas Day
    holiday[7] = "12/26/2005";		// Boxing Day
    holiday[8] = "12/27/2005";		// Christmas Day Holiday
     

    var local_timez = 4; //standard time - eastern - 5; central - 6; mountain - 7; pacific 8
    
    //put 'drawbutton();' in <script> tags in the code where you want the button to be drawn.
    //drawbutton();

