/* Comment counts */var hs = new Array(); function myCount(id)	{ 	if (document.getElementById && document.createElement && hs[id]){ 		if (hs[id] == 1){ document.write("[1 r&eacute;action]"); }		else { document.write( "[" + hs[id] + " r&eacute;actions]" ); }		}	else		{ document.write("[R&eacute;agir]"); }	}/* Dynamic Haloscan Inserter : inserts Haloscan comments in your HTML Page */ /* ***** BEGIN LICENSE BLOCK *****  * Version: MPL 1.1/GPL 2.0/LGPL 2.1  *  * The contents of this file are subject to the Mozilla Public License Version  * 1.1 (the "License"); you may not use this file except in compliance with  * the License. You may obtain a copy of the License at  * http://www.mozilla.org/MPL/  *  * Software distributed under the License is distributed on an "AS IS" basis,  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License  * for the specific language governing rights and limitations under the  * License.  *  * The Original Code is the Dynamic Haloscan Inserter.  *  * The Initial Developer of the Original Code is  * Barijaona Ramaholimihaso (e-mail address is reactions at barijaona dot com)  * Portions created by the Initial Developer are Copyright (C) 2008  * the Initial Developer. All Rights Reserved.  *  * Contributor(s):  *  * Alternatively, the contents of this file may be used under the terms of  * either the GNU General Public License Version 2 or later (the "GPL"), or  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),  * in which case the provisions of the GPL or the LGPL are applicable instead  * of those above. If you wish to allow use of your version of this file only  * under the terms of either the GPL or the LGPL, and not to allow others to  * use your version of this file under the terms of the MPL, indicate your  * decision by deleting the provisions above and replace them with the notice  * and other provisions required by the GPL or the LGPL. If you do not delete  * the provisions above, a recipient may use your version of this file under  * the terms of any one of the MPL, the GPL or the LGPL.  *  * ***** END LICENSE BLOCK ***** */// change according to your Haloscan User IDbeginURL="http://www.haloscan.com/comments/barijaona/";// wait message. Change according to your will (can be valid HTML)waitMsg="Chargement en cours...";// message for asking for e-mail notification.// replace to your will the english text given back by HaloscanemailMsg="M'aviser par email d'autres commentaires";// encoding (make it match what is in your Haloscan settings)HSencoding = "iso-8859-1";//ids of commentscurrequest="";foundrequest="";var cleaned = 1;var iwin;function writeFrameHead(){	iwin=window.frames["RSIFrame"];	iwin.document.close();	iwin.document.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\"><html>");	iwin.document.write("<head><title><\/title><\/head><body>");}function writeFrameEnd(){	iwin.document.write("<\/body><\/html>");	iwin.document.close();}function cleanFrame(){	writeFrameHead();	writeFrameEnd();	cleaned = 1;}function getComment(commentid){	if (window.setInterval && document.getElementById && document.createElement ){ //check browser functionalities		if (commentid != currequest){ //avoid extra work in case of multiple user's clicks			document.getElementById("HSd"+commentid).innerHTML = waitMsg;			if(cleaned == 1){ //previous treatment is finished				currequest=commentid;				writeFrameHead()				iwin.document.write("<script type=\"text/javascript\" src=\""+beginURL+commentid+"?m=1\"><\/script>");				cleaned = null;				writeFrameEnd();			} else { //previous treatment is still running : delay our request				setTimeout("getComment("+commentid+")",3000);			}		}	}	else {		document.location.href = beginURL+commentid;	}}function displayExternal() {	if (currequest != foundrequest){  //check that it is a new request	  	var lyr = window.frames['RSIFrame'].document.body;		if ( lyr && typeof lyr.innerHTML != "undefined" ) {			var content =lyr.innerHTML;			var pos3 = content.search(/\#BJREndContent\#\#/) //search for comments inserted in our Haloscan HTML template...			if (pos3 > 0){  //...for knowing if we finished iframe rendering				//grab what we need : comments inserted in our Haloscan HTML template are used as position markers				var pos1 = content.search(/BJRBeginTag\#/); 				var pos2 = content.search(/\#BJREndTag/);				foundrequest = content.slice(pos1+12, pos2);				content = content.slice(pos2+10, pos3);				// some fixes for various bugs and invalid HTML code returned by Haloscan				content = content.replace(/<form method="post" name="addComment"/gi, "<form method=\"post\" name=\"addComment\" accept-charset=\""+HSencoding+"\" ");				content = content.replace(/<br>/gi, "<br \/>");				content = content.replace(/<label for="subscribe">Notify me of followup comments via email<\/label>/gi, "<label for=\"subscribe\">"+emailMsg+"<\/label>");				try { // some older browsers do not handle lookahead RegExp... 					content.replace(new RegExp("&(?!(([a-zA-Z]+|\#[0-9]+);)", "g"), "&amp;");}				catch (e) {					content = content.replace(/&/g, "&amp;");					content = content.replace(/&amp;(([a-zA-Z]+|\#[0-9]+);)/g, "&$1");				}				// OK, now insert our response...				document.getElementById("HSd"+foundrequest).innerHTML = content;				// cleanup iframe of Haloscan messy code, then tell we can process other requests				setTimeout("cleanFrame()",3000);			}		}	}}setInterval("displayExternal()", 1000);