/*
This file is deprecated AFAICT, not included in any of our current templates
*/











// comment this out to stop the test
//hblRpcTrick = 1;
//hbl_max_event = 4;
//hbl_hostname = "rpc-dev.olark.com/rpc";
//hbl_hostname_delimiter = "-";
// end the comments here

config = wc_config();
config.vars["before_chat_text"] = "Olark Demo: Need Help?";
config.vars["not_available_text"] = "Olark Demo: Try Me!";

config.vars["welcome_msg"] = "This is an Olark window, it is what your visitors will see on your site.  We're around, so let us know if there is any way we can help.";
config.vars["offline_message"]    = "This is a Olark window, it is what your visitors will see on your site.  No operators are currently available, so if you need help try our <a href=\"/forum\" target=\"_top\">Forum</a>.";

if(window["hbl_to_set_username"]) {
  config.vars["before_chat_text"] = "Questions about Olark?";
  config.vars["not_available_text"] = "No Operators Available"

  config.vars["force_nickname"] = hbl_to_set_username;
  config.vars["welcome_msg"] = "Hi " + hbl_to_set_username + "! Have any questions, comments, or feature requests?  Let us know.";

  config.vars["offline_message"]    = "Need help " + hbl_to_set_username + "? We aren't here right now, but please post your question on our <a href=\"/forum\" target=\"_top\">Forum</a>.";
}

/* notify related settings */
config.vars["auto_initiate_notify_msg"]     = "(sent auto initiated message)";
config.vars["auto_initiate_notify"]         = true;    /* tell me when a message is sent */

/* if they respond, prepend this message */
config.vars["auto_initiate_response_notify"] = "(Responded to auto initiation)";

/* auto initiated */
config.vars["auto_initiate_allowed"]    = false;   
config.vars["auto_initiate"]            = false;           
config.vars["auto_initiate_period"]     = 10;      
config.vars["auto_initiate_name"]       = "ben"; 
config.vars["auto_initiate_message"]    = ["hi"];   

config.vars["disableGoogleAnalytics"] = true;



wc_init("9353-431-10-4341", config);

hbl.eventmgr.register("chat_loaded", function(q) {
    hbl.old_onblur = document.onblur;
    hbl.old_focus  = document.focus;
    hbl.blurred    = false;
    
    document.onblur = function(){ if(hbl.old_onblur) hbl.old_onblur();  hbl.blurred = true;    };
    document.focus  = function(){ if(hbl.old_focus ) hbl.old_focus();   hbl.blurred = false;   };
    
	if(document.location.toString().match(/spreedly/i)) {
		hbl.client.sendmessage("On Spreedly", true); 
	}
	
	/*
	if(document.location.toString().match(/plans/i) ) {
	    setTimeout(
	         function(){
	             if(!hbl.blurred) hbl.client.sendmessage("On Plans Page for 10 seconds", true);
	          },
	    10000);
	}
	*/
} );
window.__olarkGoogleTracker = window.pageTracker;


/* make sure we keep track of users who spoke to someone */
/*
hbl.eventmgr.register("receive_message", function(q) {
    pageTracker._setCustomVar(
      1,                        // This custom var is set to slot #1
      "ReceivedOlarkMessage",   // The top-level name for your online content categories
      "ReceivedOlarkMessage",   // Sets the value of "Section" to "Life & Style" for this particular aricle
      1                         // Sets the scope to visitor-level
    );
     
    
    if(hbl.client.buffer.length > 6) {
        pageTracker._setCustomVar(
          1,                        // This custom var is set to slot #1
          "LongConversation",   // The top-level name for your online content categories
          "LongConversation",   // Sets the value of "Section" to "Life & Style" for this particular aricle
          1                         // Sets the scope to visitor-level
        );
        pageTracker._setVar('LongConversation -' +  hbl.client.current_operator() );   
    }else {
        pageTracker._setVar('ReceivedOlarkMessage - ' +  hbl.client.current_operator() );  
    }
    
    // get nickname
    
    pageTracker._setCustomVar(
      4,                        // This custom var is set to slot #1
      "Operator",   // The top-level name for your online content categories
      hbl.client.current_operator(),   // Sets the value of "Section" to "Life & Style" for this particular aricle
      2                         // Sets the scope to visitor-level
    );

    pageTracker._setCustomVar(
      5,                        // This custom var is set to slot #1
      "Has Conversation",   // The top-level name for your online content categories
      hbl.client.is_conversation(),   // Sets the value of "Section" to "Life & Style" for this particular aricle
      2                         // Sets the scope to session-level
    );
    
    window.__olarkGoogleTracker
    
} );
*/

/* make sure we keep track of users who spoke to someone */
/*
hbl.eventmgr.register("send_message", function(q) {
    pageTracker._setCustomVar(
      3,                        // This custom var is set to slot #1
      "SentMessage",   // The top-level name for your online content categories
      "SentMessage",   // Sets the value of "Section" to "Life & Style" for this particular aricle
      1                         // Sets the scope to visitor level
    );
} );


hbl.eventmgr.register("chat_loaded", function(q) {
    if( q.opavailable ) {
        pageTracker._setCustomVar(
          2,                        // This custom var is set to slot #1
          "Operator",               // The top-level name for your online content categories
          "Available",              // Sets the value of "Section" to "Life & Style" for this particular aricle
          2                         // Sets the scope to session-level
       );
   }else {
        pageTracker._setCustomVar(
          2,                        // This custom var is set to slot #1
          "Operator",               // The top-level name for your online content categories
          "Unavailable",            // Sets the value of "Section" to "Life & Style" for this particular aricle
          2                         // Sets the scope to session-level
       );
   }
   
} );
*/



