title: How to replace the url in window.open with jquery depending on the country ip
body: <p>I ve got a problem here and I need some help. I am using a chat service called my website chat. I have setup a second account for america and all I want is to replace the <code>onclick</code> url of the chat with the american one depending on the IP address. I am using a script from "Maxmind" to detect the ip I haven't yet found a way to to replace the url in there. </p>
  
  <p>So the code I ve got is :</p>
  
  <pre><code>&lt;img src="http://static.ssl7.net/b/en/c3c88152ba6c7e56746dc864606b/1.gif" style="cursor:     pointer; border: none;" alt="Helpdesk Software" onclick="window.open('http://ssl7.net/chat/en/c3c88152ba6c7e56746dc864606b/'+document.location.href,'','height=400,width=300,menubar=no, location=no,resizable=yes,scrollbars=no,status=yes');"&gt;
  </code></pre>
  
  <p>and I need to turn it into this </p>
  
  <pre><code>&lt;img src="http://static.ssl7.net/b/en/b5695d38e0f3db83ebf705147155/8.gif" style="position:fixed;top:170px;right:0;z-index:9999;cursor:pointer;border:none;" alt="Live Support Chat" onclick="window.open('http://ssl7.net/chat/en/b5695d38e0f3db83ebf705147155/'+document.location.href,'','height=400,width=300,menubar=no, location=no,resizable=yes,scrollbars=no,status=yes');"&gt;
  </code></pre>
  
  <p>So basically the only thing that is changing is the url.
  I am trying to replace it using jquery but I cant make it work and please not that the <code>phone[country]</code> detects the ip.</p>
  
  <pre><code>j('img').each(function() {
    var href = $(this).attr('onclick');
    j(this).click(function() { window.open = 'http://ssl7.net/chat/en/b5695d38e0f3db83ebf705147155/mecmesin.com'; })
           .removeAttr('onclick' , phone[country]);
  }, );
  </code></pre>
  
  <p>Thanks a lot in advance for your kind replies.</p>