// Get the Live Chat Layer and add something to it
window.onload = function()
{
   var lyrLiveChat = document.getElementById('scEhU5');
   var intStart;
   var intEnd;
   var strCode;
   var strStart;
   var strEnd;
                   
if (lyrLiveChat)
{
intStart = lyrLiveChat.innerHTML.indexOf("onclick=\"");
                                    
 	 if (intStart != -1)
     {
         intEnd =   lyrLiveChat.innerHTML.indexOf("\"",intStart + 10);
     }
                                   
strCode = lyrLiveChat.innerHTML.substring(intStart,intEnd);
strCode = strCode.replace("onclick=\"","");
                                   
// Add tracking code
     if (!$sock = @fsockopen('www.google.com', 80, $num, $error, 5))
     {
          strCode = "_gaq.push(['_trackEvent', 'Website events', 'Livechat link clicked', '']);" + strCode;
          strStart = lyrLiveChat.innerHTML.substring(0,intStart-1);
          strEnd = lyrLiveChat.innerHTML.substring(intEnd+1);
     }
     else
     {
          strCode = "" + strCode;
     }
                                    
          strCode = strStart + "onclick=\"" + strCode + "\"" + strEnd;
          lyrLiveChat.innerHTML = strCode;
                                   
   }
}
    						
