var website=null;
var protocol='http://';
if (document.location.hostname.indexOf('binnews')!=-1) {
	website='binnewz';
	binnewz_url=document.location.hostname;
	protocol='https://'; // Force SSL!
}
else {
	if (document.location.hostname.indexOf('binsearch.info')!=-1) website='binsearch';
	else if (document.location.hostname.indexOf('nzbindex.com')!=-1) website='nzbindex';
	else if (document.location.hostname.indexOf('nzbclub.com')!=-1) website='nzbclub';
}

UrlParams=extractUrlParams();
var query=UrlParams["q"];
if(typeof query=='undefined') query='';
//Variables for the Hightlight Option
var sinceXdays=UrlParams["sinceXdays"];
if(typeof sinceXdays=='undefined') sinceXdays='';
var fromGroups=UrlParams["fromGroups"];
if(typeof fromGroups=='undefined') fromGroups='';
var showcol=UrlParams["showcol"];
var myorder=UrlParams["myorder"];
if(typeof myorder=='undefined') //if NZBIndex is accessed directly with an order param
	if(typeof UrlParams["sort"]!='undefined') myorder=UrlParams["sort"];
	else myorder='';
var pingpong=UrlParams["pong"];
if(typeof pingpong=='undefined') pingpong='';
if(document.styleSheets.length!=0)
	var sty = document.styleSheets[document.styleSheets.length - 1];
else
	var sty = null;


if (website=='binnewz') { // Binnewz modification
	Binnewz_fixedHeader();
	var tabresults = document.getElementById('table_results');
	if ( tabresults == null )
	{
		tabresults=document.getElementById('tabliste');
	}

	// We need to know which column is for title or file or ... (this changes regarding the results' category)
	var THCol=tabresults.getElementsByClassName('column_heading marker');
	for ( i = 0; i < THCol.length; i++ )
	{
		if ( THCol[i].firstElementChild != null )
		{
			if(THCol[i].firstElementChild.textContent=="Titre"){
				var titleIndex=i+1;
				continue;
			}
			else if(THCol[i].firstElementChild.textContent=="Newsgroup"){
				var groupsIndex=i+1;
				continue;
			}
			else if(THCol[i].firstElementChild.textContent=="Fichier"){
				var fileIndex=i+1;
				continue;
			}
			else if(THCol[i].firstElementChild.textContent=="Taille"){
				var sizeIndex=i+1;	
				continue;
			}
			else if(THCol[i].firstElementChild.innerHTML.indexOf('Merci')!=-1){
				var thanksIndex=i+1;
				continue;
			}
		}
	}

	if ( titleIndex != null )
	{ // On est sur une page normale de liste de référencements
		var resultsType=1;
		var cat_id=UrlParams["cat_id"];
		if (typeof cat_id=='undefined')
			cat_id=document.getElementById('fp_cat_id').value;
		var binnewz_goodCat=['6','23','39','27','48','49','100','101','102','103','104','105','11'];
		var binnewz_tvCat=['7', '26', '44'];
	}
	else
	{
		if(document.getElementById('DivRes')!=null) {	
			//page de recherche : méthode temporaire (resultsType=2)
			resultsType=2;
			var titleIndex=2; 
			var groupsIndex=4;
			var fileIndex=5;
			var sizeIndex=6;
			var thanksIndex=9;
		}else{ //page des derniers référencements (resultsType=3)
			resultsType=3;
			var catIndex=2;
			var titleIndex=4; 
			var groupsIndex=6;
			var fileIndex=7;
			var sizeIndex=8;
			var thanksIndex=11;
		}
	}

	binnewz_DeleteAd();

	if ( tabresults != null )
	{
		display_nzb_links(); // NZB Links on results
		resize_binnewz(tabresults, '100');
	}
}



// *** Globals ***
var olddiv; //from the display_nzb_links function
function display_nzb_links(){
	var binnewz_strpostdays='&sinceXdays='
	var binnewz_postdays='';
	var binnewz_strpostgroups='&fromGroups='
	var binnewz_postgroups=''

	if (document.getElementsByClassName('bigred').length < 5) //on est sur une page de résultats par catégroies ou une recherche (les pages là n'ont qu'un appel et la calsse 'bigred' normalement ... c'est bancal mais binnews est mal foutu donc ...)
		if(document.getElementsByClassName("ligneclaire").length>0)
			var search_array = document.evaluate( '//tr[@class[.="ligneclaire" or .="lignefoncee" ] and not(@done)]' ,document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null );
		else
			var search_array = document.evaluate( '//tr[@class[.="even" or .="odd" ] and not(@done)]' ,document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null );
	else {//on est sur la pages des derniers référencements
		var lfTRs=document.getElementsByClassName('lf');
		for(i=0;i<lfTRs.length;i++)
			lfTRs[i].previousElementSibling.className='le';

		var search_array = document.evaluate( '//tr[@class[.="lf" or .="le" ] and not(@done)]' ,document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null );
	}

	for (var n=0; n < search_array.snapshotLength; ++n){
		var TR=search_array.snapshotItem(n);
		TR.style.height="31px";
		var TDs=TR.children;

		var titleTD=TDs[titleIndex]; 
		var groupsTD=TDs[groupsIndex];
		var fileTD=TDs[fileIndex];
		var sizeTD=TDs[sizeIndex];
		var elementTitle;

		if ( titleTD.innerHTML.indexOf('cadenas.png')!=-1 || titleTD.innerHTML.indexOf('virus.gif')!=-1 )
		{
			// Password protected or virus result - Highlight if password
			setProtectedRow(titleTD.parentNode);
			titleTD.style.backgroundColor = "#FDD5D7";
			titleTD.onmouseover=function(){  this.style.background="#FDD5D7";}
		}

		var Acol=titleTD.getElementsByTagName('a');
		if ( Acol.length > 0 )
		{
			elementTitle = Acol[0].innerHTML.toLowerCase();
			// Testing if there is binnews link or not, if so, we do nothing and step to the next result line
			if ( Acol[0].href.indexOf(binnewz_url) != -1 )
			{
				continue;
			}
		}
		else
		{
			elementTitle = titleTD.textContent.toLowerCase();
		}

		var req=fileTD.innerHTML.replace(/ /g, "+");
		// req=req.split("*").join(" ");
		var req_amp=req.replace("&amp;","&");
		var method1=req_amp;
		var method2=encodeURI(req_amp);
		var method3=encodeURI(req).replace("&amp;","%26");

		//Retrieving post's age
		if(resultsType==3) //pour les derniers refs sur binnewz, on place arbitrairement sinceXDays à 0 jours
			var tmp=0;
		else
			var tmp=binnewz_getdays(TR.previousElementSibling.firstChild);
		if (typeof tmp!='undefined')
			if (tmp!=-1) binnewz_postdays=tmp;
			else binnewz_postdays='';
		//else we use the post days retrieved before
		//Retrieving post's group(s)
		binnewz_postgroups='';
		var tmp_links=groupsTD.getElementsByTagName('a');
		for(i=0; i<tmp_links.length; i++)
			if (tmp_links[i].childElementCount==0) //If not, theres something else than a group name in this link (like the 'not free' img)
				binnewz_postgroups=binnewz_postgroups + tmp_links[i].innerHTML.replace('.','') + '|';
		binnewz_postgroups=binnewz_postgroups.substring(0, binnewz_postgroups.length-1);

		//end
		//By les-newsgroup.fr : Added a test of checked options  before every 'make_link()'
		//By les-newsgroup.fr : Added protocol variable (http/https)
		//By les-newsgroup.fr : Added the 'sinceXdays' & 'fromGroups' param 
		//By les-newsgroup.fr : Added a float attribute to the links div (optionnable)
		//By les-newsgroup.fr : Modifications in the show/hide functions
		var div = document.createElement("div");
		div.setAttribute('style', 'float:right;');
		make_link(div,"http://NiouzeFire_Plus_Search/"+method1+"[titleNiouzeFire="+elementTitle+"]","NiouzeFire+","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjExR/NCNwAABs9JREFUSEuNVnlQk3cazt+7szPdme3+sRYPirPFddp6dbeX3Y5o0e0ickilIOUQREg4g4TEkAIBc5AEIeFIIDeIHCIIpRxKVgFFCEXkFCFAAEEUCypdMD77y0dmdjrjOH1m3r/yfc/7vs/zvElob8LT5y+dFn5eY3YM/dzY1tY5/UOVYVWWV7KaX2Weru9e+sE8/iyx58GzzY7Hfzte2l5t7jH/pE+VGNYNZRqMVgaiTBoBpSACA7URWG7yhsV4CK1SD5SL6evKfJXu1sjyO47X34zJ+efHrupkT4NDYlDF9kRD/EcQMRNg8H4PBX57oBILcMHYhnCRCXvDKrA3WIcjQZkICYtfUqsv+jpoXo+mnofRTQWxNvn5ZLSy3VEb5go5lw3d105IiWHjQu0kNNceoezGIio6HkPZPI8TWbfhGtqI3XFmeMcbbfnKcrqD7tdQtSx4tShZthrWAVQJ6ehlboeQdRYdzA8Qw5IjTj2Js/op8MqtEF2ZRVHTPNXIYFrE6bx72BHWiL2JfTgl6bKZ+p/4OGg3kHbJusmoLX08wt+JbF4yJmS70M7/BJU5MchMYcAjawTewlGckI4hRD4ORrEFnNJpZNfOQXP9EdUkQNQL11Ot+Jw9AGnd3FLH8Mr/PeFKjJqb6V9gVLYbClEK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+nw+epRvZN7LeSVTm1Ojyz+mfqmlXaEoU4twRDBk+s/8cL+CkYGCFxHM/A8rAYamU6TjLO4e7tMmChhqqWujz85YskbHJLJQ0ySRCERKpc6iA/jmlF94NnCorcDrVK+vZgZcKCIjsdHL4ILB4HcexkhMRzEZrAw5XqHNisajJ5KfDwEp5PGPF3L/v0PDh9xcdmanopkUkBl2/0KGmefWhZ+OVPDvoNmGrE7tNG7/WVK25Yv+mLdTPxYohO/OCQ1BAvpkiCrHJShcTYFEKcsTH5YQG2fC2hjHYmHqTqh9bmn64ddND+GvWl/JMWo8/a83p32Dr9iFQhpAm5jftnSWLS8GriPPiZSY6pyX38S+QwOA8uvsXIMA6uLS6v+zvoXg+BKONAiyJkdqmaNLEbbg4i8Y2ApS0S3zGY1LR20i0eOY54KvB59BVc7pibWf2v7YCD5s1w8S97yzNcIGYkpS/zJRIEJIjx7rELG9+q9rwTI3cEGPBVUhMyy8dWhqwvsskfhT86Xv/t2Mkw/2FXQn8Q+ZHRewlGzX6iIet3OSPWeLXFLKqZ1VXfehJEvvPfcjz+GtBo/wMinxWQYApw6AAAAABJRU5ErkJggg==");
		make_link(div,nzbclub_makeurl(method2.replace('.part.nzb',''),"&rpp=200&rs=1&sa=1" + binnewz_strpostdays + binnewz_postdays + binnewz_strpostgroups + binnewz_postgroups),"NZBClub","data:image/x-png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAWCAYAAADTlvzyAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA+lJREFUeNqsVc9vG0UU/vaXvdSJ4/iHaEISUey2UAGNoa7iW6CAkIpKDz0gQBx6QIoQqsQxEtf+ASBUiUMvlIIQBxRASIS2EarUCA4g0pIgJW1K2roiztqxY8fr9WaZN/ZsN2vH6aFP2p03b2be9+a9b2Ykx3EgJJ1Oy5FIZKher+/ZYoJdRJIkiPXUUl/YScjF3Nzcimmam41Gg9tUr4NKpaJls9mx/v7+QQZqiYXdAIVj+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AAAAElFTkSuQmCC");
		make_link(div,protocol+"www.nzbindex.com/search/?results=250&sort=age_desc" + binnewz_strpostdays + binnewz_postdays + binnewz_strpostgroups + binnewz_postgroups + "&q="+method3.split("*").join(" "),"NZBindex","data:image/x-png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAWCAYAAAGkkcxkAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAABMlJREFUeNpi+P//P4OgoKAsCDOAAEiAwWze/3v37gMZDBxggfcfv/z//v07WAAggBi5ubmF2NjYuMHKp06duuvajTv/GXRm/Wfi5+dnUFeWZXh/NIoBIIAYQfr6+vp2eXh4uIINBQJGRkYGbW1tThYQR0BAgEE7/CgDAzszw+sd/gyiDmshikCqra2ti2RlZZ0YkMDKlStDAAIILCkkJCSLLAEy9u3bt4/Bxh45cuQRSBFIEAR4eHjAaphA5NK9bxiCG64xaEcdY5i55SWDhCgfWBFYkp2dg6E6ThPIY2RgY2djYOPkRzjo69fv/1lYGBm+//zLwMLMxMDDzQmWA9uZnJy4lQEVMK1YsYIBIIAYYR6fMmXKIU9PT1sGPADkUAkJCXagnl9MMMG/f//+2HP2DUN+7xUGTjZGhq/ffzPk910FiTNsPf6SIb/nCgMbC8IPcI2cnJwMT98CFZ19xyAdsJ/h/N2fDFuPvGLg5uZhePDyD8PWw6+AEc8Ht50FxuDg4GBg/cXGwPDxJ8P/G0kMEm5rQKmCgZeXl4GZhZWB4c9foDWcCHeD/AjCQA/v+vPnz398+D8kQDhAFEAAPqpdJWIgit68x6yPL5D8gx/hB2yVQvIXSmprOxt7G7WzkIVlt1UIW0oaK3crQSWanZCAm3hmyAwjKxkIcznh3DPcc2Ys5ZLO3sDinBdN05TmUXfyPF/ixyAxTdNbbLFJtJBlQjd9fJUVsxYT1maqYn+X0dnlC90/flLg+3R+/UoXdys66PHpotAN/kx1FDI5/oendzo5PqTZ4gMkD3gg8SjCdB1nW1GoyE6hQ9F4TiFzpYIPm8QSJNu2t4mWx6RvV6dH1CG0q7dKEploCFwQ/1VET5jcUon7vpyOiUDetECDQOIWrpKpSH3IQ2GueCnWvJKvRfHNuy98dV1LvFxXXZIkNyowrunT3ojp2vMM3O3TbSgq4k8cxxPs7VAAsix7VvWvAKVVTUsbYRB+kt133+xiSOIXxJqLCZQee/MWVMSDBoIEvJlD6Un7J3rw4KE9Fe89pE2P9aTgR7RUD/6EqKCCoifRBtnNhzNvNjHZ1BDIuwy7O/vsDPPxzDT56E4NXzKZzMTj8Xfcm+jjCCF8hULhsFgs7rX60D04M5VKfUyn07OlUqkff2pY0Mj7RQ6P6PXpNYeqxDrl0DINSFHPYblSozlWdbNAzRnQ1L1araFEeo6AsYaLt52qskE16MiS36tg4HDEwsbva8RmdhBb2Edi6Q/Ob2wMhU08lf14u/wXsbldTK6cEF5gdNDCev6yjidZy11ghGy0tVk3h4YhEZAUvEm9a+moUDjzn47x+fuZMmTxN9ozzB7aXRCteBJTCmWjZ4eCyKC7rQm7gtXMBEbeDODbj1O8/3CgUsx/+uiShGXRNL1BmDptDdnGwK4O4XPB3F3EwsR4CLdbi1iYjuHu6hH3/xxVTK4jR8hzo4l3+4D6tPcI+YQGJKLDJqJDJhFUki0/Nr9MI/91CmNBQ+lHIwHlsKYZCAddPEmInr3E7dgZjdGRy+W2eXw4jk17wlHCz7b9Ig192XGaOi+eTzab/dnYMf8dNS5/ZD1S0RPftC7fqLYdRryTRm1W3gMcPPo7bIyKjYdai5NneQAnEnLrIpsAAAAASUVORK5CYII=");
		make_link(div,binsearch_makeurl(method1, "&server=1" + binnewz_strpostdays + binnewz_postdays + binnewz_strpostgroups + binnewz_postgroups),"Binsearch","data:image/x-png;base64,[encoded data, 4872 characters]");
		make_link(div,binsearch_makeurl(method1, "&server=2" + binnewz_strpostdays + binnewz_postdays + binnewz_strpostgroups + binnewz_postgroups),"Binsearch \"other groups\"","data:image/x-png;base64,[encoded data, 4360 characters]");
		make_link(div,"http://www.yubse.com/?q="+method1.replace('.part.nzb',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7u5xlpoLXmYLjZoQc3wcjJcnSEpuusLHx8YssLyop6YMgo349vcJVFwOhpIOhZASYmoOZm+EkI4OipYTjZgGQ0oHSVAMc30Nb3k6qrQgnWKkAAAABHRSTlP///8AQCqp9AAAAUtJREFUeNpiYMYCGKC0Y/TK6dpmKIJrNvomMt0+MsfUFSG4s5+pK9+Wnd1890yVcqjgfAvZzYtCGRizs+fyHN2gCRZ8dlPj4GnvnAa733f4vlXNegcWXPwmr/26cvMUzi1XxGv+MByXBApW3Fx373nbY/0Qz2093+0/RzaVAAXFoi5rbZ/kvHfa/2Ov1URfJITNAAqyGTcano3PVUqNe79E4IEQ64IskOD52sNSsa9S0vhv1e2RUbByuwYUfNjNFSH/T1pR4tzHrxyCciZ9XkDBSgM/1n1/rXvvpvP+/MKx68xkPZCTZvv72AT+uuQU8LL4woqYtT+egQRdbnTWn5xQZKn+qKB62dZDGRBv7k86cEq3w12k9C13kHA4LEAyHSZ6rFp9InnqfZYnhfCgM/qw9OLyHfNYNgWXIQfywquqrS06n1BDHgUABBgAA6yBzwYBQOsAAAAASUVORK5CYII=");
		div.innerHTML+="&nbsp;";
		make_link(div,"http://www.nzbfriends.com/?q="+method1.replace('.part.nzb',''),"NZBFriends","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAVVJREFUOI3FkbFKw1AUhr+WSKUBIbYIWilCBkeRCA6OVhddBLsmmz5CfYT0Fbo1YyL4AMZOilMGVyElFAqlKJ1aKoXGIba3t606if92/nv4zn/ugf9Witgq4YQG1mMV//SK9kDD1D2csCx1mnqAExoztUeq3lRwQgM3somtgOvnMu1BCVMPcCN7btiN5N21KsTWQXpqzNIBClkfVWkuZC5kfXKZgNFYwwnLAvDULUmNtdcTDvMeALlMMPWPNnyON71JKQDdoZwA4KWXQPc0X/LfhtoiYDTWJEhsabx/JPXljkjgRjaNToVcJsDUawIwgUzU6ouViqpIoCpNVtK9L7iRlh5mdRsl03OZgFS9N/XPtmtcFKsAOOEMYCsbSIDv9p+TAOyvC0CrL/bPr/aILflCSz8RkhsDFFUR2Y1szh/upbrRqSwH7K7Ja/wkVWli6t7vjX+tT2Ssd9q5c7BYAAAAAElFTkSuQmCC");

		div.innerHTML+="&nbsp;&nbsp;&nbsp;&nbsp;";

		if (resultsType==1) {
			make_thxlink(div, TDs[thanksIndex].firstChild.href);
				if(in_array(cat_id,binnewz_goodCat))
				{
					make_infoLink(div, titleTD, 'movie')
					make_link_movieInfos(div,"http://NiouzeFire_Plus_MoviesInfos/"+elementTitle,"Movie Infos with NiouzeFire+","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAWCAYAAADTlvzyAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjEwMPRyoQAABblJREFUSEvlVWlMVFcUfmPTpqQxKSpgokBFoIobJkIBSxnTRn9pKkGkiI228Y//ilEba5Mq1oVoq4CIWAQXFtlEkRGYlRlmmAFmYNhGGBhQkWVANkcWRb+ee0ESTZo0aX806U1O7nv3nnu+7zvnvPuE/8/wW7ly5apVq3atXbs2Zv369TEbNmyICQwMjAkKCooJCQmJ2bhxI5uDZt3/2XB3dxc8PT1zvby84OPjgxUrVsDPzw9r1qzBunXr4O/vDyLBZjXxEtE+N/IX0VnRkiVL/o7NgMmVSsHDwyOHbNzT8xMwUG9vb/j6+s4Bk3KsXs1s9RSRsNFso3Ub7dvIz0b+tmXLltmItM3d3cO2dOlSGwG8a0VSuVwkVFRqd5gbm6aNpjo0WR6grb0DHV0P8fBxN7p7evGktx+9/Xb02QfQPzAIO7PBQf7MrJfWe/rs5NeHx0960PXoMdo7u9BmbUfLg1ZQbOira1Brqn+l0eq+FZRqzTfmpmZIJBIolEoO0msfxMDQMIZHxzDqeI5nzyfwbHyCP9ufDqFvFog9j4w5MOYYx+iz5xgaG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BaDrIYKSlGNsY47GmqMSLyYjDNn4jlzVqtbt3KRnZ2NYxTUldLMUs0u+djYWCQlXcRRUnYhMYk3H4vDGpDFrKCOpQyO+vj6ughOTk7vBwcHfyEWi78WizfN2KYZ+ywoKNLbx+fX3bt3Wwj41aWUFFKRyi0hIQGnT5/hWTh+PO5VZOTOFq/ly09QLSPfnGexSD03+peKCeuDmX/UXw8R2XyRSBTo4uoaGxYmztu5M8q4d+931j179lojdkTWfh4amrtokcsP5BPAfGfP/CvjPTInkWies2jePFduIpEzW5vd+y8OQfgTyGS3DcPpJE4AAAAASUVORK5CYII=");
				}
				else if(in_array(cat_id,binnewz_tvCat))
				{
					make_infoLink(div, titleTD, 'tv')
					make_link_movieInfos(div,"http://NiouzeFire_Plus_MoviesInfos/"+elementTitle,"Movie Infos with NiouzeFire+","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAWCAYAAADTlvzyAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjEwMPRyoQAABblJREFUSEvlVWlMVFcUfmPTpqQxKSpgokBFoIobJkIBSxnTRn9pKkGkiI228Y//ilEba5Mq1oVoq4CIWAQXFtlEkRGYlRlmmAFmYNhGGBhQkWVANkcWRb+ee0ESTZo0aX806U1O7nv3nnu+7zvnvPuE/8/wW7ly5apVq3atXbs2Zv369TEbNmyICQwMjAkKCooJCQmJ2bhxI5uDZt3/2XB3dxc8PT1zvby84OPjgxUrVsDPzw9r1qzBunXr4O/vDyLBZjXxEtE+N/IX0VnRkiVL/o7NgMmVSsHDwyOHbNzT8xMwUG9vb/j6+s4Bk3KsXs1s9RSRsNFso3Ub7dvIz0b+tmXLltmItM3d3cO2dOlSGwG8a0VSuVwkVFRqd5gbm6aNpjo0WR6grb0DHV0P8fBxN7p7evGktx+9/Xb02QfQPzAIO7PBQf7MrJfWe/rs5NeHx0960PXo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yj6srNI/LZHc5/VgNwJrHJKP8xcuIDExEfTngLOzM+iPgdtFRYiOjn6LRJhYjIyMa0hNvYJfjh3DFQI1mRt4rCLyl9y/D52hZvTHI0fmCx/TIBaDrIYKSlGNsY47GmqMSLyYjDNn4jlzVqtbt3KRnZ2NYxTUldLMUs0u+djYWCQlXcRRUnYhMYk3H4vDGpDFrKCOpQyO+vj6ughOTk7vBwcHfyEWi78WizfN2KYZ+ywoKNLbx+fX3bt3Wwj41aWUFFKRyi0hIQGnT5/hWTh+PO5VZOTOFq/ly09QLSPfnGexSD03+peKCeuDmX/UXw8R2XyRSBTo4uoaGxYmztu5M8q4d+931j179lojdkTWfh4amrtokcsP5BPAfGfP/CvjPTInkWies2jePFduIpEzW5vd+y8OQfgTyGS3DcPpJE4AAAAASUVORK5CYII=");
				}
		}else {
			//sur les pages de recherche et de derniers ref le lien pour commenter et le lien pour remercier sont ensembles
			if(typeof TDs[thanksIndex].children[1] != 'undefined')
				make_thxlink(div, TDs[thanksIndex].children[1].href);

				if(resultsType==2){ //page de recherche
					catTitle=TR.parentNode.parentNode.previousElementSibling.textContent;
				}else if(resultsType==3){ //page des derniers refs
					catTitle=TDs[catIndex].textContent;
				}

				if(catTitle.indexOf('Série')!=-1)
				{
					make_infoLink(div, titleTD, 'tv');
					make_link_movieInfos(div,"http://NiouzeFire_Plus_MoviesInfos/"+elementTitle,"Movie Infos with NiouzeFire+","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAWCAYAAADTlvzyAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjEwMPRyoQAABblJREFUSEvlVWlMVFcUfmPTpqQxKSpgokBFoIobJkIBSxnTRn9pKkGkiI228Y//ilEba5Mq1oVoq4CIWAQXFtlEkRGYlRlmmAFmYNhGGBhQkWVANkcWRb+ee0ESTZo0aX806U1O7nv3nnu+7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EWirDKgy1OD6zSzIZDKYGxpgsVgglytQUlLC1XR2dkJVoYZSVYGmpiakpaXNgTHbvj2cSGYg/doNUOY4mFJdCalC+TItPcNdOJ+Q6KyoUDvYpk5fzVlRXZGZmQm1WoN9+/bBxcWFB2PXnFqt5iTqqTNVBMp8Dh48CLpzsWXLFqSkXMZvv59HTl4+V8fKw9LJRKVnXHcVTpw89VGpVDYiU6ggJSUVGi0kZeU4eeo01eguQkND31IQHx+PvLw8BAQEYPHixfzaO3fuHAoLb/NUXr2ajp+O/oyS0jJSpkGZTI5yilsmlTuSki85C9G7Yj6srNI/LZHc5/VgNwJrHJKP8xcuIDExEfTngLOzM+iPgdtFRYiOjn6LRJhYjIyMa0hNvYJfjh3DFQI1mRt4rCLyl9y/D52hZvTHI0fmCx/TIBaDrIYKSlGNsY47GmqMSLyYjDNn4jlzVqtbt3KRnZ2NYxTUldLMUs0u+djYWCQlXcRRUnYhMYk3H4vDGpDFrKCOpQyO+vj6ughOTk7vBwcHfyEWi78WizfN2KYZ+ywoKNLbx+fX3bt3Wwj41aWUFFKRyi0hIQGnT5/hWTh+PO5VZOTOFq/ly09QLSPfnGexSD03+peKCeuDmX/UXw8R2XyRSBTo4uoaGxYmztu5M8q4d+931j179lojdkTWfh4amrtokcsP5BPAfGfP/CvjPTInkWies2jePFduIpEzW5vd+y8OQfgTyGS3DcPpJE4AAAAASUVORK5CYII=");
				}
				else if(catTitle.indexOf('Films')!=-1 || catTitle.indexOf('Anime')!=-1)
				{
					make_infoLink(div, titleTD, 'movie');
					make_link_movieInfos(div,"http://NiouzeFire_Plus_MoviesInfos/"+elementTitle,"Movie Infos with NiouzeFire+","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAWCAYAAADTlvzyAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjEwMPRyoQAABblJREFUSEvlVW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RY6oHE8PA6GtATm6+v5D6R5oHbU6zRbZZTXUouF0ErU7H65Keno5t27YhKioKCiLBlFxOTUXypRRYrVYUFxfDzc1tjlRERASysrKRm1+AKvocWFy1VgdqztfXb2T6CsmXU93oZZK+EWirDKgy1OD6zSzIZDKYGxpgsVgglytQUlLC1XR2dkJVoYZSVYGmpiakpaXNgTHbvj2cSGYg/doNUOY4mFJdCalC+TItPcNdOJ+Q6KyoUDvYpk5fzVlRXZGZmQm1WoN9+/bBxcWFB2PXnFqt5iTqqTNVBMp8Dh48CLpzsWXLFqSkXMZvv59HTl4+V8fKw9LJRKVnXHcVTpw89VGpVDYiU6ggJSUVGi0kZeU4eeo01eguQkND31IQHx+PvLw8BAQEYPHixfzaO3fuHAoLb/NUXr2ajp+O/oyS0jJSpkGZTI5yilsmlTuSki85C9G7Yj6srNI/LZHc5/VgNwJrHJKP8xcuIDExEfTngLOzM+iPgdtFRYiOjn6LRJhYjIyMa0hNvYJfjh3DFQI1mRt4rCLyl9y/D52hZvTHI0fmCx/TIBaDrIYKSlGNsY47GmqMSLyYjDNn4jlzVqtbt3KRnZ2NYxTUldLMUs0u+djYWCQlXcRRUnYhMYk3H4vDGpDFrKCOpQyO+vj6ughOTk7vBwcHfyEWi78WizfN2KYZ+ywoKNLbx+fX3bt3Wwj41aWUFFKRyi0hIQGnT5/hWTh+PO5VZOTOFq/ly09QLSPfnGexSD03+peKCeuDmX/UXw8R2XyRSBTo4uoaGxYmztu5M8q4d+931j179lojdkTWfh4amrtokcsP5BPAfGfP/CvjPTInkWies2jePFduIpEzW5vd+y8OQfgTyGS3DcPpJE4AAAAASUVORK5CYII=");
				}
		}

		div.style.visibility = "hidden";
		div.className = 'linksDiv';

		NZBLinksTD = titleTD;
		NZBLinksTD.setAttribute('style',"vertical-align:text-top; padding-top:5px; padding-right:2px;");		
		NZBLinksTD.parentNode.addEventListener( "mouseover", make_visible, false );
		NZBLinksTD.parentNode.addEventListener( "mouseout", make_invisible, false );
		NZBLinksTD.appendChild(div);

		TR.setAttribute('done', 1); //we set a 'done' attribute to avoid re executing this script func with autopager plugins
	}
}

function nzbclub_makeurl(search, otherparams)
{
	var host='www.nzbclub.com/search.aspx';
	var params='?sp=1&q='+escape(search);
	params+='&sinceXdays=' + sinceXdays + '&fromGroups=' + fromGroups;
	if(typeof otherparams!='undefined') params=params+otherparams;
	return protocol+host+params
}

function binsearch_makeurl(search, otherparams)
{
	var host='www.binsearch.info/';
	var params='?q='+escape(search)+'&max=250';
	if(typeof otherparams!='undefined') params=params+otherparams;
	return protocol+host+params
}

function setProtectedRow(row) {
	row.setAttribute("title", "Password");
}

//Added by Les-Newsgroup.fr
function binnewz_getdays(node)
{
	if (node.className=="data datepost" || node.className=="datepost data" || node.className=='datepost' || node.className=='data')
	{
		var txtDate=node.getElementsByTagName("span")[0].innerHTML;
		if (txtDate.indexOf('jours')!=-1) //Binnewz affiche soit 'jour' ou 'jours'
			var txt=txtDate.slice(12, -6).trim();
		else var txt=txtDate.slice(12, -5).trim();
		if ((parseInt(txt) % 1)==0) return txt;
		else return -1;
	} else return 0;	
}

function extractUrlParams()
{
	var t = location.search.substring(1).split('&');
	var f = [];
	for (var i=0; i<t.length; i++){
		var x = t[ i ].split('=');
		f[x[0]]=x[1];
	}
	return f;
}

function Binnewz_fixedHeader()
{
	document.getElementById('home').setAttribute('style', 'position:fixed');
	document.getElementById('menu_search').setAttribute('style', 'position:fixed; width:100%;');
	document.getElementById('form_subcat').setAttribute('style', 'display:inline-block;');
	document.getElementById('menu_lien').setAttribute('style', 'z-index:99');
}

function resize_binnewz(resultsNode, tabwidth)
{
	resultsNode.setAttribute('style', 'width:'+tabwidth+'% !important; margin:1 !important; margin-left:'+(100-tabwidth)/2+ '%')
}

function binnewz_DeleteAd()
{
	var mark = document.getElementsByName("haut");
	if (mark != null && typeof mark[0] != 'undefined') {
		if(mark[0].nextElementSibling.tagName=="DIV" && mark[0].nextElementSibling.className=="") 
			mark[0].parentNode.removeChild(mark[0].nextElementSibling);
	}

	// Autres tests au cas où
	var frame = document.getElementById("headerContainer");
	if (frame!=null) frame.outerHTML = "";

	frame = document.getElementsByName("banner");
	if (frame!=null && typeof frame[0]!='undefined') frame[0].outerHTML = "";
	
	divAd = document.getElementById("zzadcontent");
	if (divAd!=null && typeof divAd!='undefined') divAd.parentNode.removeChild(divAd);

	divAd = document.getElementById("zzadfooter");
	if (divAd!=null && typeof divAd!='undefined') divAd.parentNode.removeChild(divAd);	
}



function make_link(elem,cible,title,img)
{
	var newLink = document.createElement("a");
	newLink.href=cible;
	newLink.target="_blank";
	var new_img = document.createElement("img");
	new_img.src=img;
	new_img.title='Search for a NZB on ' + title;
	new_img.alt='Search for a NZB on ' + title;
	newLink.appendChild(new_img);
	elem.appendChild(newLink);
}
function make_link_movieInfos(elem,cible,title,img)
{
	var newLink = document.createElement("a");
	newLink.href=cible;
	newLink.target="_blank";
	var new_img = document.createElement("img");
	new_img.src=img;
	new_img.title=title;
	new_img.alt=title;
	newLink.appendChild(new_img);
	elem.appendChild(newLink);
}

function make_visible(event)
{
	var targetTR=event.target;

	while (targetTR.nodeName!='TR')
		targetTR=targetTR.parentNode;

	var div = targetTR.getElementsByClassName('linksDiv')[0];
	if (div)
	{
		olddiv=div;
		div.style.visibility="";
	}
}

function make_invisible(event)
{
	if((event.relatedTarget==null || (event.relatedTarget!=olddiv && event.relatedTarget.parentNode.parentNode!=olddiv)) && olddiv != undefined ){
		olddiv.style.visibility="hidden";
	}
}

function make_thxlink(div, ThxUrl)
{
	var ThxLink = document.createElement("a");

	  (function(ThxUrl) {  // Cette fonction permet d'ajouter un eventListener avec la bonne URL à chaque image 'merci' rajoutée
		ThxLink.addEventListener('click', function() {
		  merci(ThxUrl);
		}, false);
	  })(ThxUrl);

	ThxLink.href='javascript:void(0);';
	var ThxImg = document.createElement("img");
	ThxImg.src='http://'+binnewz_url+'/_images/merci.gif';
	ThxImg.title='Thanks !';
	ThxLink.appendChild(ThxImg);
	div.appendChild(ThxLink);
}

function make_infoLink(div, titleTD,type) {

	var Acol=titleTD.getElementsByTagName('a');
	if (Acol.length>0){ //testing if there is a link or not
			var elementTitle=Acol[0].innerHTML.toLowerCase();
			var element=titleTD.firstElementChild;
	}else{
		var elementTitle=titleTD.textContent.toLowerCase();
		var element=titleTD.firstChild;
	}		

	var infoLink = document.createElement("a");		
	infoLink.href='javascript:void(0);';
	var infoImg = document.createElement("img");
	infoImg.src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAADvUlEQVR4Xt1VbWscZRQ9szOz3dmdbLLJJm6ycXGi0tXGGihlDdhUFNSkRZAWKeKHIJQVP4iCaWl+gIUFzRdLlCAqaFXUD0KInxRfoCgIVgtpg22iJrpss0m67mR3dt7We9nZMCxhoeabZ/Ywl7n3OWfufeZh8b+GMDA2FR86nsuOnLowf/T0u0vHXr64Of7Sxc2Hn39n6eAzb85zbuDoVJxrsRvaJERt4vzpu1KJM/cMxrVONQRBaJQ6jgvTcWBaDm79Y2CtsLWSLxRzKwvn5jiNFgTQgtj+8fCBEzNzRw7fP5sZTmndnQrqABKdAsbuU/DIgQgGYxIYbJzW7tCG92uz6affmIulJ8JtOwh29AfvffzVt48cSk9G1X2wbBd1uvh37HCcxPrAWFwu4NPv89RNHY5LNZTXKzUsXl99b+Wr17NmOW/u1oHYP5rNHkxrk2FFhlGzebEnUkc4EkFPTw8TEYpdeubWG7RsB/uCElLJxCRrsBY8SM1OuodPJAcHk2fjXQoM0/Y1Vwdp4KelIqIdUe4IPy6us2mDTsPEprgjHER3vO+s/sDJLzaufLbKi5sqUurRc6+MZg7lYlGFF+xsamNCbEJ0AYff2m2QOvRMXCYoRJlGdX3p6pk/vz4/A8BudhBSO7snlJDMc/c2pw5G9skEZFlmQpIa5YZhIPf5slcB7hAukwyDskRiXRMAZol600CJhMNDXGg7rn/ncWHhbwh05V4c3THQdR2l8lUYpoVazYFpO7CaXXB3kIZY028gK4oS46Q3HiIQoLtLM67WTIRCIaiqiiau/V5kMdT9h0nwYkGKsaZ/k0Wap2BTi7yCxY2ahVu6ga2yge2qBdu24QcLBwICdgHvFydEvwEqlUrJtrvUimFho1SlU1pFjVoX+CLHtgeo1cAxS62fqaOXS2urBTW5SeI8Tx6PGAjgv8AxK2t88xtY5eIflxy5KyOAhQXsBbXS2iXW9J/kaunGtwuwjaKwN224VrXIWqzpNzCqxd9ubOevfII9gjVYizX9Bg5x4+bPH35gbK58Ax8+ms7gy9wTO2eAwTE/45wfvJY1WIs1Wz8GkdgrBsMP9j/0wnSoZ2gMtwFjY/m7/A9vvUYb/AuAdb+BHzKxj5juHTn1nJocOS4G1Xj7L0Yv6n9dnl+//DG/+TXiTaKFNmCTBDETjPZPktH7qcemf6V/uMLdT81sMznmZ5zjGq711shoh5ZxRYmat3iceJL4LNOLx72c5tWKuE0I3jlRib3EAeKdTC/u9XJSu4P9L+NiwHW8zQYnAAAAAElFTkSuQmCC';
	infoLink.appendChild(infoImg);
	infoImg.title='Info';
	infoLink.display="none";

	if(type=='movie') { // Movie rating

		elementTitle=cleanup(elementTitle);

		  (function(element) {
			infoLink.addEventListener('click', function() {
			  googleRequest(elementTitle.replace(/ /g, "+"), element);
			}, false);
		  })(element);		

		infoLink.display="";
	}else if(type=='tv') {
		  (function(element) {
			infoLink.addEventListener('click', function() {
			  betaseriesGetUrl(cleanup_serie(elementTitle), element);
			}, false);
		  })(element);		

		infoLink.display="";
	}
	div.appendChild(infoLink);
}

// Thank You function for Binnewz
//url=http://www.binnews.(in|biz)/_bin/thanks.php?i=?????&...
function merci(ThxUrl) {
	var xhr = new XMLHttpRequest();
	xhr.open("GET", ThxUrl, true);
	xhr.onload = function (e) {
		if (xhr.readyState === 4) {
			if (xhr.status === 200) {
				console.log(xhr.responseText);
			} else {
				console.error(xhr.statusText);
			}
		}
	};
	xhr.onerror = function (e) {
		console.error(xhr.statusText);
	};
	xhr.send(null);
}

//this function let me do another google request with the other language (selected from option)  IMDB if nothing has been found with the FR url.
//the 'stop' param is used to stop redundancy
function googleRequest(searchTitle, element, othertry)
{
	var xhr = new XMLHttpRequest();
	xhr.open("GET", String('http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=["' + (othertry=='year'?searchTitle.replace(/\s*[0-9]{4}$/, ''):searchTitle) + '"]+site:imdb.' + (othertry=='lang'?'fr':'com') + '/title'), true);
	xhr.setRequestHeader('Accept', 'application/atom+xml,application/xml,text/xml');
	xhr.setRequestHeader('Access-Control-Allow-Origin', '*');
	xhr.onload = function(responseDetails) {
				console.log('Req status ' + xhr.status + ' ' + xhr.responseText);
				var gR = eval('(' + xhr.responseText + ')');
				if (gR.responseData!=null){
					if (typeof gR.responseData.results[0]=='undefined'){
						switch (othertry){	//if error occurs, we do another try
							case 'lang': //that was the first othertry ... we go next to the  second other try ... trying the same search but without the Year
								if (searchTitle.match(/[0-9]{4}$/) != null) {
									googleRequest(searchTitle, element, 'year');
									break;
								}else
									othertry='year';

							case 'year': //that was the second othertry ... we go next to the  third other try ... trying with omdbAPI (Title + Year)
								yearMatch=searchTitle.match(/[0-9]{4}$/);
								imdbRequest('', element, yearMatch==null?'':yearMatch[0], 1, searchTitle.replace(/\+?\(?.?[0-9]{4}$\)?/g, '')); //first imdb try : Using the private API (omdbapi.com)
								break;
								
							default: //no othertry param : we do the first othertry
								googleRequest(searchTitle, element, 'lang');
								break;			
						}

					}else {
						if (gR.responseData.results && gR.responseData.results.length > 0) {
							yearMatch=searchTitle.match(/[0-9]{4}$/);
							imdbRequest(gR.responseData.results[0].url.replace('.com', '.fr'), element, yearMatch==null?'':yearMatch[0], 1, searchTitle.replace(/\+?\(?.?[0-9]{4}$\)?/g, '')); //first imdb try : Using the private API (omdbapi.com)
							
						}
					}
				}else{
					yearMatch=searchTitle.match(/[0-9]{4}$/);
					imdbRequest('', element, yearMatch==null?'':yearMatch[0], 1, searchTitle.replace(/\+?\(?.?[0-9]{4}\)?/g, '')); // Google block us, we can use omdbAPI instead	
				}
			};
	xhr.onerror = function (e) {
		console.error(xhr.statusText);
	};
	xhr.send(null);
}

//This function can search for a movie via two ways : using the site www.omdbapi.com or using the imdb website
//First try is done with omdbapi (the fastest), second try with imdb website
function imdbRequest(imdbUrl, element, year, useAPI, movieTitle)
{
	if (useAPI) {
		if (imdbUrl!='' && (imdbMovieId=imdbUrl.match(/title\/tt([0-9]+)\//))) 
			requestUrl="http://www.omdbapi.com/?i=tt"+imdbMovieId[1];
		else
			requestUrl="http://www.omdbapi.com/?t="+movieTitle;

		if(year!='') requestUrl+="&y="+year;
	}else{
		requestUrl=imdbUrl.substring(0, imdbUrl.lastIndexOf('/')+1)+"combined";
	}

	var xhr = new XMLHttpRequest();
	xhr.open("GET", requestUrl, true);
	xhr.setRequestHeader('Accept', 'application/atom+xml,application/xml,text/xml');
	xhr.setRequestHeader('Access-Control-Allow-Origin', '*');
	xhr.onload = function(responseDetails) {
		if(useAPI){
			var arrRes = eval('(' + xhr.responseText + ')');
			if (arrRes.Response=="True") { //no error while fetching movie+arrRes.Title + "' -- " + requestUrl);		
				if(imdbUrl=='') 
					imdbUrl='http://www.imdb.com/title/' + arrRes.imdbID + '/combined';
				else
					imdbUrl=imdbUrl.substring(0, imdbUrl.lastIndexOf('/')+1)+"combined";
				addratingLinkToElement(element, [arrRes.Title + " (" + arrRes.Year + ")", arrRes.imdbRating, imdbUrl, arrRes.imdbVotes.indexOf(',') != -1 ?arrRes.imdbVotes.replace(",",""):arrRes.imdbVotes], 1, 1);	
			}else if(imdbUrl!=''){ //cant go further if could not find more about this item before (in googleRequest func)
				imdbRequest(imdbUrl, element, year, false, movieTitle);
				return 0;
			}else {
				addratingLinkToElement(element, 1, 1, 1, true);
			}
		}else{
			var res = xhr.responseText;  
			var votesMatch = res.match(/<a href="ratings" class="tn15more">(.*) votes/); // <a href="ratings" class="tn15more">6,072 votes</a>
			var ratingMatch = res.match(/<div class="starbar-meta">\s*<b>(\d[,\.]\d)\/10<\/b>/); //<div class="starbar-meta"><b>8.3/10</b> 
			var imdbTitle = res.match(/<title>(.*)<\/title>/)
			if (imdbTitle != null) 
				imdbTitle=imdbTitle[1];
			else
				imdbTitle='';

			var rating = 0.0;
			var votes = "0";

			if (ratingMatch) {
				rating = parseInt(ratingMatch[1]);
				votes = votesMatch[1];
			}
			addratingLinkToElement(element, [imdbTitle, rating, xhr.finalUrl, votes], 1, 1);
		}
	};
	xhr.onerror = function (e) {
		console.error(xhr.statusText);
	};
	xhr.send(null);
}


function betaseriesGetUrl(serie_details, element)
{
	if (serie_details == null) return 0;
	var serieTitle=serie_details[1];
	var serieUrl='';

	var xhr = new XMLHttpRequest();
	xhr.open("GET", 'http://api.betaseries.com/shows/search.json?key=7ecb330c435e&title='+serieTitle, true);
	xhr.setRequestHeader('Accept', 'application/atom+xml,application/xml,text/xml');
	xhr.setRequestHeader('Access-Control-Allow-Origin', '*');
	xhr.onload = function(responseDetails) {
		var arrRes = eval('(' + xhr.responseText + ')');

		if (arrRes.root.code=="1" && typeof arrRes.root.shows[0] != 'undefined') { //no error while fetching serie and fetched at least 1 serie

			if(typeof arrRes.root.shows[1] == 'undefined') //only one serie fetched, so we assumed that we found the good one ... can't verify it
				serieUrl=arrRes.root.shows[0].url;
			else{//fetched more than 1 serie ... but there can be only one !!
				// var show;
				// var showCount=0;
				for(show in arrRes.root.shows){
					if(arrRes.root.shows[show].url == serieTitle.replace(' ', '') || arrRes.root.shows[show].title.toLowerCase() == serieTitle.replace(' ', '') || arrRes.root.shows[show].url == serieTitle.replace(' ', '-') || arrRes.root.shows[show].title.toLowerCase() == serieTitle.replace(' ', '-')) { //trying to find an exact match
						serieUrl=arrRes.root.shows[show].url;
						break;
					}					
				}
			}

			if(serieUrl != '') {
				serie_details.push(serieUrl);
				betaseriesGetInfos(serie_details, element);
			}
		}
	};
	xhr.onerror = function (e) {
		console.error(xhr.statusText);
	};
	xhr.send(null);
}

function betaseriesGetInfos(serie_details, element)
{
	var serieTitle=serie_details[1];
	var serieSeason=serie_details[2];
	var serieEpisode=serie_details[3];
	var serieUrl=serie_details[4];
	var infosType=1;
	
	if(infosType==1 || typeof serieSeason == 'undefined' || typeof serieEpisode == 'undefined') //We're fetching serie's Infos
		var url='http://api.betaseries.com/shows/display/' + serieUrl + '.json?key=7ecb330c435e';
	else
		var url='http://api.betaseries.com/shows/episodes/' + serieUrl + '.json?key=7ecb330c435e&season=' + serieSeason + '&episode=' + serieEpisode;


	var xhr = new XMLHttpRequest();
	xhr.open("GET", url, true);
	xhr.setRequestHeader('Accept', 'application/atom+xml,application/xml,text/xml');
	xhr.setRequestHeader('Access-Control-Allow-Origin', '*');
	xhr.onload = function(responseDetails) {
		var arrRes = eval('(' + xhr.responseText + ')');

		if (arrRes.root.code=="1") { //no error while fetching infos
			if(infosType==1 || typeof serieSeason == 'undefined' || typeof serieEpisode == 'undefined'){
				var objInfos=arrRes.root.show;
			}else{
				var objInfos=arrRes.root.seasons[0].episodes[0];
			}
			addratingLinkToElement(element, [objInfos.title, objInfos.note.mean, 'http://www.betaseries.com/episode/' + serieUrl + '/s' + serieSeason + 'e' + serieEpisode, objInfos.note.members.toString()], 2, 2);		
		}else {
			addratingLinkToElement(element, 1, 1, 1, true);
		}
	};
	xhr.onerror = function (e) {
		console.error(xhr.statusText);
	};
	xhr.send(null);
}



//element: DOM Object
//ratingLink : rating informations [title, note, url of info page, votes]
//mediaType : 1 => Imdb
//                    2 => BetaSeries
//Modifier : 1 => original note is 10based
//                 2 => original note is 5based
function addratingLinkToElement(element, ratingLink, mediaType, modifier, ratingError)
{ //modifier is a new param : it is used with a value of 2 when the note is 5based ... so that we can calculate a 10based note
	ratingError=ratingError||false; //set default

	//if theres no error within the presume imdb url (means we do find 'imdb' or 'betaseries' inside it), we set 2 variables to let us insert the imdb link later
	if (typeof ratingLink[2] != 'undefined' && (ratingLink[2].indexOf('imdb') != -1 || ratingLink[2].indexOf('betaseries') != -1)) {
		ratingOpenLink="<a target='_blank' href='" + ratingLink[2] + "'>";
		ratingCloseLink="</a>"
	}else{ 
		ratingOpenLink=""; 
		ratingCloseLink=""
	}

	if (ratingLink && ratingLink != -1)
	{
		ratingElement = "<!-- Container -->";
		ratingElement += "<div style='height:20px; margin-left:10px; margin-top:3px; '>"; // For two lines

		ratingElement+=ratingOpenLink;

		ratingElement += "<!-- Starbar --><div ";
		if (ratingLink[1] != 'N/A' && typeof ratingLink[1] != 'undefined' && ratingLink[1]>=0 )
			ratingElement+="title='" + (mediaType==2?'Episode : ':'') + ratingLink[0].replace(/['"]/g, ' ')  + "  - " + "Note: " + ratingLink[1] * modifier + " / 10" + " " + " with " + " " + formatVotes(ratingLink[3]) + " " + "votes" + "' ";
		
		ratingElement+="style='height:20px; float:left;'>";
		

		noresult=false;
		if (ratingError){
			ratingElement += "Rating error";
		}else if( ratingLink[1] == 'N/A' || typeof ratingLink[1] == 'undefined' || ratingLink[1]<=0 ) {
			ratingElement += "No rating";
			noresult=true;
		}else {
			imdbrating='';
			imdbrating  = "<div style='width: " + 1 * 100 + "px;height: 20px;background: url(data:image/png;base64," + starimage2 + ") no-repeat 0px 0px;'>";
			imdbrating += "<div style='width: " + 1 * 10 * ratingLink[1] * modifier + "px;height: 20px;background: url(data:image/png;base64,starimage1) no-repeat 0px -20px;'>";
			imdbrating += "</div>";
			imdbrating += "</div>";
			ratingElement += imdbrating;
		}

		if(!noresult) {
			ratingElement += "</div><!-- End Starbar -->";
			ratingElement += ratingCloseLink;
			ratingElement += ratingOpenLink + "<b>";
			ratingElement += "&nbsp;" + ratingLink[1] * modifier;

			// Adding /10 (or /5) on rating display
			ratingElement += " / " + 5 * Math.abs(modifier-3);
			ratingElement += "</b>" + ratingCloseLink;
		}
		else // normal behavior		
		{
			ratingElement+=ratingCloseLink;
			ratingElement += "</div><!-- End Starbar -->";
		}

		ratingElement += "</div>&nbsp;";
		newText= element.parentNode.innerHTML + ratingElement;
		element.parentNode.innerHTML = newText;
	}
}


var starimage =''+
'iVBORw0KGgoAAAANSUhEUgAAAMgAAAAoCAMAAACMwkUuAAAAAXNSR0IArs4c6QAAAARnQU1BAAC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JoMUQ3XPaih5RQBJDENLcOkQBSRhBSLNrEQUk'+
'PgQhbaETUUDiRRDS5joQBSQeBCHNqkEUkDgQpLlN9wYDWg1ejhztTq9HEkxpthudDkkwpdmutVok'+
'wZRmO+vsRBJMabbTjg4kwZRmO9ZokARTmFtCVuNKXMnUiMQZSzGNSGzhQ6YRicW3xzQiMXt3mEYk'+
'Jk+QaURidKyz1/0tPiEuV1Wm9gafLqeT/ZT04dNls7Gfkl58uiwW9lPSg0+X2cx+Srrx6TKZ2E9J'+
'Fz5dRqPkU2KAnxUtxy9T08OWIMqKZEdAAhS3ZEdAAhS7ZEdAApQFyY6ABChzkh0BCVCsLRC8HpdM'+
'TY8HKFIIttikEGyxSCHYYpZCsMUkhWCLkWl+WIlfmILVyNNWQLEiTIBEbG5QuIVRkIjNDgq7MAwS'+
'sS2AYkEYBInY5kAxJwyARGxWUFiFfpAwkCnDFDnuM/eytAn9BLkq03e0jepGyVWZvKFtWDtMrsr4'+
'NW2DnYPkqoyd0TbQMUCuysgpbf2afnJVho6Z+0ofU78s7Q19iMVL0kcfYvGS9NKHWLwkPfQhFi9J'+
'N32IxUvSRR9iq/oX7CXOP0hn0ljJajC/AAAAAElFTkSuQmCC';


function cleanup(str)
{
	/* Small function to cleanup a string, remove html tags, underscores, weird characters etc. */
	str = str.replace(/ \(?(\+|sur)?(\s*a(lt)?.*\.?b.*\.[a-z0-9\.\-_@]+)\s*\)?/ig, '')
		.replace(/(autres? post|\*.*\*)/i, '')
		.replace(/\"/g, '') // "
		//.replace(/\'/g, '') // '  //do not replace '
		.replace(/\./g, ' ') // . --> space
		.replace(/_/g, ' ') // underscore to space
		.replace(/\(/g, ' ')//(
		.replace(/\)/g, ' ')//)
		.replace(/ +/g, ' ') // double spaces
		.replace(/ $/, '') // remove last lonely space
		.replace(/&amp;/g, 'et') 
		.replace(/<\/?[^>]+(>|$)/g, ""); // HTML TAGS
	return str;
}

function cleanup_serie(str)
{
	/* Small function to cleanup a string, remove html tags, underscores, weird characters etc. */
	str = str.replace(/[_-]/g, ' ') // _ or - to space
		.replace(/[\(\)\."\[\]\{\}]/g, '')
		.replace(/&amp;/g, 'and') 
		.replace(/[:;\?,!-]/g, ' ')
		.replace(/ +/g, ' ') // double spaces
		.replace(/ *$/, '') // remove lonely spaces
		.replace(/^ */, '') // remove lonely spaces
		.replace(/<\/?[^>]+(>|$)/g, ""); // HTML TAGS

	serie_details = str.match(/^(?:\s*)(.*) (?:s|saison|season) *([0-9]{1,2})(?:[\- ,;]*(?:e|ep|ep\.|episode|episodes) *([0-9]{1,3}))?/i);
	//serie_details[1]:title
	//serie_details[2]:season
	//serie_details[3]:episode
	return serie_details;
}

// This function adds thousand separator to the number paramter
function formatVotes(nvotes)
{
	if(isNaN(nvotes)) return;
	var sRegExp=/([0-9]+)([0-9]{3})/i;
	while (sRegExp.test(nvotes))
	{
		nvotes = nvotes.replace(sRegExp, '$1 $2');
	}
	return nvotes;
}

// *** HELPERS ***
//http://userscripts.org/scripts/source/51832.user.js
//Integration de cette ressource dans le script (pour Chrome)

// =====================================[ String helpers ]===
// add prototype trim (taken from [uso:script:12107]
String.prototype.trim = function() { return this.replace(/^\s+|\s+$/, ''); };

// ======================================[ Array helpers ]===
/** Is the item part of the array?
 * @function in_array
 * @param mixed needle
 * @param array haystack
 * @return boolean
 */
function in_array(item,arr) {
  for(p=0;p<arr.length;p++) if (item == arr[p]) return true;
  return false;
}
/** Return all the keys of an array
 * @function array_keys
 * @param array arr
 * @return array keys
 */
function array_keys(arr) {
  var keys = new Array();
  for (key in arr) keys.push(key);
  return keys;
}
// ============================[ Common variables helper ]===
/** Is a given variable already defined?
 * Returns FALSE if any of the passed variables is not set,
 * TRUE if all passed variables are set. You can pass as many
 * arguments as you want, e.g. isset(o.var1,o.var2,o.var3)
 * REMEMBER: Checking isset(varname) when varname was not declared yields
 * an JS error "varname is not defined". Use window.varname instead.
 * @function isset
 * @param mixed varname
 * @return boolean
 */
function isset() {
  if (arguments.length===0) return false;
  for (var i=0;i<arguments.length;i++) {
    if (typeof(arguments[i])=='undefined'||arguments[i]===null) return false;
  }
  return true;
}
/** Escape RegExp special chars
 * @function escapeRegExp
 * @param string s
 * @return string escaped
 * @brief taken from Greasespot code snippets
 */
function escapeRegExp(s) {
  return s.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1');
}
// ========================================[ DOM helpers ]===
/** Get elements by className
 * @function getElementsByClassName
 * @param string className
 * @param optional string tag restrict to specified tag
 * @param optional node restrict to childNodes of specified node
 * @return Array of nodes
 * @author Jonathan Snook, http://www.snook.ca/jonathan
 * @author Robert Nyman, http://www.robertnyman.com
 */
function getElementsByClassName(className, tag, elm){
  var testClass = new RegExp("(^|\\s)" + className + "(\\s|$)");
  var tag = tag || "*";
  var elm = elm || document;
  var elements = (tag == "*" && elm.all)? elm.all : elm.getElementsByTagName(tag);
  var returnElements = [];
  var current;
  var length = elements.length;
  for(var i=0; i<length; i++){
    current = elements[i];
    if(testClass.test(current.className)){
      returnElements.push(current);
    }
  }
  return returnElements;
}
/** Get elements whose id matches the given regexp
 * @function getElementsByIdRegExp
 * @param RegExp regex
 * @param optional string tag restrict to specified tag
 * @param optional node restrict to childNodes of specified node
 * @return Array nodes
 * @author Arthaey Angosii http://userscripts.org:8080/users/4440
 * @author Izzy http://userscripts.org:8080/users/izzysoft
 */
function getElementsByIdRegExp(regex,tag,elm) {
  var matchingElements = [];
  if (!regex) return matchingElements;

  tag = tag || '*';
  elm = elm || document;
  var elements = (tag=='*' && elm.all)? elm.all : elm.getElementsByTagName(tag);
  for (var i = 0; i < elements.length; i++)
    if (elements[i].id.match(regex))
      matchingElements.push(elements[i]);
  return matchingElements;
}

/** Append an element to a given node
 * @function appendElement
 * @param string nodeID ID of parentNode
 * @param string tag nodeType
 * @param string id ID for the new node
 * @param string className
 * @param string textVal innerHTML
 * @param boolean retEl return the created element?
 */
function appendElement(node,tag,id,classnam,textVal,retEl) {
  if (!document.getElementById(node)) return;
  try {
    var el = document.createElement(tag);
  } catch(e) {
    return;
  }
  id ? el.id = id : null;
  classnam ? el.className = classnam : null;
  el.innerHTML = (textVal ? textVal : '');
  var retNode = document.getElementById(node).appendChild(el);
  if (retEl) return retNode;
}
/** Create new element
 * Example call: var styles = createElement('link', {rel: 'stylesheet', type: 'text/css', href: basedir + 'style.css'});
 * @function createElement
 * @param string type e.g. 'link', 'a', 'p'
 * @param object attributes
 * @return node
 * @brief taken from Greasespot code snippets
 */
function createElement(type, attributes){
 var node = document.createElement(type);
 for (var attr in attributes) if (attributes.hasOwnProperty(attr)){
  node.setAttribute(attr, attributes[attr]);
 }
 return node;
}
/** Insert a node after another
 * @function insertAfter
 * @param node newNode
 * @param node before
 * @brief taken from Greasespot code snippets
 */
function insertAfter(newNode, node) {
  return node.parentNode.insertBefore(newNode, node.nextSibling);
}
/** Remove an element by ID
 * @function removeElementById
 * @param mixed id string for ID or the node itself
 * @return boolean success
 */
function removeElementById(id) {
  if (!id) return;
  var node = (typeof(id)=='string') ? document.getElementById(id) : id;
  var res = node.parentNode.removeChild(node);
  if (res) return true;
  return false;
}
/** Remove an element by name
 * @function removeElementByName
 * @param string name name of the element to remove (or the node itself)
 * @return boolean success
 */
function removeElementByName(nam) {
  if (!nam) return;
  var node = (typeof(id)=='string') ? document.getElementByName(nam) : nam;
  var res = node.parentNode.removeChild(node);
  if (res) return true;
  return false;
}
/** Remove elements by className
 * @function removeElementsByClassName
 * @param string className
 * @param optional ancestor (default: document)
 * @return boolean success FALSE if one or more elements failed or none found
 */
function removeElementsByClassName(cname,node) {
  node = node || document;
  var elms = node.getElementsByClassName(cname);
  if (elms.length<1) return false;
  for (var i=0;i<elms.length;i++)
    if ( !removeElementById(elms[i]) ) return false;
  return true;
}
/** Remove elements by tag name
 * @function removeElementsByTagName
 * @param string tag name
 * @param optional node ancestor (default: document)
 * @return boolean success FALSE if one or more elements failed or none found
 */
function removeElementsByTagName(tag,node) {
  if (!tag) return false;
  var node = node || document;
  var elms = node.getElementsByTagName(tag);
  if (elms.length<1) return false;
  for (var i=0;i<elms.length;i++)
    if ( !removeElementById(elms[i]) ) return false;
  return true;
}
/** Get next sibling skipping possible whiteSpace(s) in between
 * @function nextSibling
 * @param node startSib
 * @return mixed nextSibling node when found, FALSE otherwise
 * @brief taken from Greasespot code snippets
 */
function nextSibling(startSib) {
  if (!(nextSib=startSib.nextSibling)) return false;
  while (nextSib.nodeType!=1) if (!(nextSib=nextSib.nextSibling)) return false;
  return nextSib;
}
