/* Hack to get XMLHttpRequest support in IE */
/*@cc_on @if (@_win32 && @_jscript_version >= 5) if (!window.XMLHttpRequest)
window.XMLHttpRequest = function() { return new ActiveXObject('Microsoft.XMLHTTP') }
@end @*/

/**************** /
/* Tips en venn */
/***************/
var oldDivContent ="";
  function tipsVenn()
  {
          oldDivContent = document.getElementById("tipsvennbox").innerHTML;
      var theform = document.getElementById('tipsform');
      var parameters =
          "to_email=" + theform.to_email.value+
          "&from_email=" + theform.from_email.value+
          "&from_name=" + theform.from_name.value+
          "&comment=" + theform.comment.value+
          "&link=" + theform.link.value+
          "&title=" + theform.title.value+
          "&teaser=" + theform.teaser.value;
      
      document.getElementById("tipserrorlog").innerHTML="Laster..";            
      var xhReq = new XMLHttpRequest();      
      
      xhReq.open("post", theform.action, false);                             
      xhReq.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      xhReq.setRequestHeader("Content-length", parameters.length);
      xhReq.setRequestHeader("Connection", "close");
      xhReq.send(parameters);
                  
      if(xhReq.responseText.charAt(0)=="o")
      {
      var respons=xhReq.responseText.substring(1,xhReq.responseText.length);
      document.getElementById("tipsvennbox").innerHTML=respons;
      }
      else
      {
      document.getElementById("tipserrorlog").innerHTML=xhReq.responseText;          
      }      
      return false;      
  }    

  function reloadTipsVenn()
  {
      document.getElementById("tipsvennbox").innerHTML=oldDivContent;
      document.getElementById("tipserrorlog").innerHTML="";
  }
