document.write('<link rel="stylesheet" type="text/css" href="src/rssinline.css">');
document.write('<link rel="stylesheet" type="text/css" href="src/lecteurinline.css">');

//document.write("<BASE TARGET=_blank>");

var FILEPHP = "http://www.singularite.info/src/lecteurinline.php?&urlrss=";
//var PHPLOGOIFRSS = "http://www.singularite.info/src/logoifrss.php?&urlrss=";
var PHPLOGOIFRSS = "http://www.singularite.info/simpleSearch3.php?&urlrss=";
var oxmlhttp = null;
var divid = "divajax";	// id div flottant a manipuler
var odiv =null;		// obj divid flottant à utiliser (associer à divid)
var oxmlhttp2 = null;

function FermerDivInline()
{
try {


if(window.ActiveXObject)
{

// var owin =  document.getElementById('IFRMFEEDRSS').contentWindow;
// owin.document.execCommand("stop", false, null);
//document.execCommand("stop", false, null);
}
else
{
 try {
	// var owin =  document.getElementById('IFRMFEEDRSS').contentWindow;
	// owin.stop();
	//window.stop();
       }catch(e){}
}

odiv.innerHTML = "";
document.body.removeChild(odiv);
odiv=null;
}catch(e){}

}


/*
function validurl(evt)
{
if(document.getElementById("txturlsite").value == "") return ;

 if(window.ActiveXObject)
 { 
 if(window.event.keyCode == 13) 
    { window.event.returnValue = false; 
	gethttp(escape(FILEPHP + document.getElementById("txturlsite").value));
    }	
 }
 else
 {
 if( evt.which == 13)
	gethttp(escape(FILEPHP + document.getElementById("txturlsite").value));
 }

}
*/

function getimg()
{
var oimg = document.createElement("img");
oimg.src= "img/activity.gif";
oimg.align = "middle";
odiv.appendChild(oimg);

//odiv.innerHTML +="<center><img src='img/activity.gif' alt=''></center>";
}

function gethttptest(strurl)
{ 
var strxml;
var DrapIE= true;
strurl = FILEPHP + unescape(strurl);

window.showdiv();


odiv = document.getElementById(divid);
odiv.innerHTML = "<div align='center' onclick='javascript:Ajaxabort()' style='cursor:pointer;color:black'>Stop</div>"; 
odiv.innerHTML += '<a id="adivajax" href="javascript:void(0)" onclick="return getimg()">En cours de traitement....</a>';
//odiv.innerHTML +="<center><img src='img/activity.gif' alt=''></center>";

document.getElementById("adivajax").onclick();

var tm = setTimeout("javascript:gethttp2('"+strurl+"')",3000,"javascript");
/*
var oimg = document.createElement("img");
oimg.src= "img/activity.gif";
oimg.align = "middle";
odiv.appendChild(oimg);
*/
}



function gethttp(strurl)
{ 
var strxml;
var DrapIE= true;
var strurlrequest = unescape(strurl);
//strurl = FILEPHP + unescape(strurl);
strurl2 = FILEPHP + escape(strurl);

window.showdiv();


odiv = document.getElementById(divid);


odiv.innerHTML = "<div align='center' onclick='javascript:Ajaxabort()' style='cursor:pointer;color:black'>Stop</div>"; 
odiv.innerHTML +="<center><img src='img/activity.gif' alt=''></center>";
odiv.innerHTML +="<center><span id='spanwaitajax' style='color:black'></span></center>";

		try
		{
		 if (window.XMLHttpRequest)
		 {  
			oxmlhttp = new XMLHttpRequest();

			if(document.layers)	 //netscape
			{		pref("signed.applets.codebase_principal_support", true);
					pref("security.checkloaduri", true);
					netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserAccess');
			     	//oxmlhttp.overrideMimeType("text/xml;utf-8"); //OK a utiliser pour netscape
			     	oxmlhttp.overrideMimeType("text/html;charset=iso-8859-1"); //OK a utiliser pour netscape

					oxmlhttp.open("GET",strurl2,true);  //true:asynchrone
			}					
			else
			{
			//oxmlhttp.overrideMimeType("text/xml"); //OK
			oxmlhttp.open("GET",strurl2,true);   // true obligatoire
			//oxmlhttp.setRequestHeader("content-type","text/html;charset=iso-8859-1"); // pour une reponseXML
			oxmlhttp.setRequestHeader("content-type","text/xml;charset=utf-8"); // pour une reponseXML			
			}
			oxmlhttp.send(null);  
			oxmlhttp.onreadystatechange = function()
			{  
  	        
					 try
					 {
						if (oxmlhttp.readyState == 4){
							
							if (oxmlhttp.status == 200) {
							 strxml = oxmlhttp.responseText;
							sizeFile = strxml.length;
						 	
							if(window.ActiveXObject)
							odiv.innerHTML = '<div align="center" style="width:99.5%;border:1px solid black;cursor:pointer;color:white;background-color:black" title="Fermer cette fenetre" onclick="javascript:FermerDivInline();return false;" >Fermer</div>';
							else
							odiv.innerHTML = '<div align="center" style="width:100%;border:1px solid black;cursor:pointer;color:white;background-color:black" title="Fermer cette fenetre" onclick="javascript:FermerDivInline();return false;" >Fermer</div>';

							
							odiv.innerHTML = strxml;;
		
							
						  }
						}
						 
					 }catch(e){};	
			}


			
			 DrapIE = false;
		  }
			if(window.ActiveXObject)
					DrapIE = true;

		
		 }catch(e){}		
}



function getrequest(strurl,objElem)
{ 
var strxml;
//alert(strurl)
strurl = unescape(strurl);


		try
		{
		 if (window.XMLHttpRequest)
		 {  
			oxmlhttp = new XMLHttpRequest();

			if(document.layers)	 //netscape
			{		pref("signed.applets.codebase_principal_support", true);
					pref("security.checkloaduri", true);
					netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserAccess');
			     	//oxmlhttp.overrideMimeType("text/xml;utf-8"); //OK a utiliser pour netscape
			     	oxmlhttp.overrideMimeType("text/html;charset=iso-8859-1"); //OK a utiliser pour netscape

					oxmlhttp.open("GET",unescape(strurl),true);			//true:asynchrone
			}					
			else
			{
			//oxmlhttp.overrideMimeType("text/xml"); //OK
			oxmlhttp.open("GET", unescape(strurl),true);   // true obligatoire
			//oxmlhttp.setRequestHeader("content-type","text/html;charset=iso-8859-1"); // pour une reponseXML
			oxmlhttp.setRequestHeader("content-type","text/xml;charset=utf-8"); // pour une reponseXML			
			}
			oxmlhttp.send(null);  
			oxmlhttp.onreadystatechange = function()
			{  
				//alert(oxmlhttp.responseText.length)
                         
					 try
					 {
						if (oxmlhttp.readyState == 4){
							if (oxmlhttp.status == 200) {
							 strxml = oxmlhttp.responseText;
							sizeFile = strxml.length;
						 	//alert(strxml)							
							objElem.innerHTML =strxml;
							
						  }
						}
					 }catch(e){};	
			}
		  }
		
		 }catch(e){}		
}




function getlogoifrss(strurl,idrss,total,QueryPlusOne,TotalResultParQuery,strlang,totalreq)
{ 
var strxml;
var DrapIE= true;


strurl = unescape(PHPLOGOIFRSS + strurl + "&TotalResult=" + total + "&page=" + QueryPlusOne + "&TotalResultParQuery=" + TotalResultParQuery + "&lang=" + strlang);

var odiv = document.getElementById(idrss);
		try
		{
		 if(window.XMLHttpRequest)
		 {  
			oxmlhttp2 = new XMLHttpRequest();
			
			if(document.layers)	 //netscape
			{		pref("signed.applets.codebase_principal_support", true);
					pref("security.checkloaduri", true);
					netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserAccess');
			     	oxmlhttp2.overrideMimeType("text/html;charset=iso-8859-1"); //OK a utiliser pour netscape
					oxmlhttp2.open("GET",strurl,true);			//true:asynchrone
			}					
			else
			{
			//oxmlhttp2.overrideMimeType("text/xml"); //OK
			oxmlhttp2.open("GET",strurl,true);   // true obligatoire
			oxmlhttp2.setRequestHeader("content-type","text/html;charset=iso-8859-1"); // pour une reponseXML			
			}
			oxmlhttp2.send(null);  
			oxmlhttp2.onreadystatechange = function()
			{
					 try
					 {
						if (oxmlhttp2.readyState == 4){
							if (oxmlhttp2.status == 200) {
							 strxml = oxmlhttp2.responseText;
							sizeFile = strxml.length;


							if(document.getElementById("chekboxResultatParPage").checked.toString() == "false")
							{

							document.getElementById("divsearch").innerHTML = "<div id='divstart'></div><div id='divendsearch' align='center'>************************</div>";


							}

							var objdiv = document.createElement("div");							
							var odivfirst = odiv.childNodes.item(0);
							objdiv.innerHTML = strxml;
							objdiv.id="divResult-" + totalreq;//alert(document.getElementById("chekboxResultatParPage").checked );
							odiv.insertBefore(objdiv,odivfirst);

						  }
						}
						 
					 }catch(e){};	
			}
			
			 DrapIE = false;
		  }
			if(window.ActiveXObject)
					DrapIE = true;

		
		 }catch(e){}		
// document.getElementById('TDSEARCHWAIT').innerHTML  = "";
}



function SeachTypeUrl2(strurl,spanrss)
{ 
var strxml;
var DrapIE= true;
//strurl = PHPLOGOIFRSS + strurl;

var objspanrss = null;
objspanrss = document.getElementById(spanrss);
//objspanrss.innerHTML = '<span style="cursor:pointer;margin-right:2px;font-size:10px;color: #fff; background: midnightblue;padding: 0px 5px;  margin-left: 0; border: solid 1px #fff; float: left;" onclick="javascript:getlogoifrss(&quot;http://www.singularite.info/src/logoifrss.php?&urlrss=' + unescape(strurl) +'&quot;,&quot;' + spanrss +'&quot;)">RECHERCHER</span>';
//var tmyws = setTimeout("javascript:document.getElementById('divsearch').style.height=document.getElementById('divendsearch').offsetTop - document.getElementById('TSEARCH').offsetTop + 100 + 'px'",5000,"javascript");
var oxmhttp3 = null;
		try
		{
		 if (window.XMLHttpRequest)
		 {  
			oxmlhttp3 = new XMLHttpRequest();

			if(document.layers)	 //netscape
			{		pref("signed.applets.codebase_principal_support", true);
					pref("security.checkloaduri", true);
					netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserAccess');
			     	oxmlhttp3.overrideMimeType("text/html;charset=iso-8859-1"); //OK a utiliser pour netscape
					oxmlhttp3.open("GET",unescape(strurl),true);			//true:asynchrone
			}					
			else
			{
			//oxmlhttp3.overrideMimeType("text/xml"); //OK
			oxmlhttp3.open("GET",unescape(strurl),true);   // true obligatoire
			oxmlhttp3.setRequestHeader("content-type","text/html;charset=iso-8859-1"); // pour une reponseXML			
			}
			oxmlhttp3.send(null);  
			oxmlhttp3.onreadystatechange = function()
			{
					 try
					 {
						if (oxmlhttp3.readyState == 4){
							if (oxmlhttp3.status == 200) {
							 strxml = oxmlhttp3.responseText;
							sizeFile = strxml.length;

							//document.getElementById("TXTAREA").value += strxml + "\n";

							 objspanrss.innerHTML = strxml;
						  }
						
						}
						
					 }catch(e){};	
			}
			
			 DrapIE = false;
		  }
			if(window.ActiveXObject)
					DrapIE = true;

		
		 }catch(e){}		
}





function Ajaxabort()
{
oxmlhttp.abort();
oxmlhttp = null;
document.getElementById(divid).innerHTML = ""; 
if(odiv)
{
try{
 document.body.removeChild(odiv);
}catch(e){};
 odiv = null; 
}

}

function showdiv() {
if(odiv)
{
// alert(odiv)	
try{
 document.body.removeChild(odiv);
}catch(e){};
 odiv = null; 
}
var objdivajax = document.createElement("div");

if(window.ActiveXObject)
objdivajax.className = "ieclassrss";
else
objdivajax.className = "classrss";

objdivajax.id = divid;
document.body.appendChild(objdivajax);

odiv = document.getElementById(divid);


if(window.ActiveXObject)
 {

//odiv.style.width= "80%";

odiv.style.top= document.body.scrollTop + 20;
odiv.style.height= ( ( (window.screen.availHeight - 50 - 20) * 100) / window.screen.availHeight ) + "%";
 }   
  else
 { 
//odiv.style.top= document.body.scrollTop + 20;
odiv.style.top = window.pageYOffset + 20;
//odiv.style.width= "72%";
odiv.style.height= ( ( (window.innerHeight - 50 - 10) * 100) / window.innerHeight ) + "%";
//alert("scrollTop:" + document.body.scrollTop +  "   pageYOffset:" + window.pageYOffset)
 } 	


}


function showdivPlusMoins(e,evt) {

if(odiv.className != "classrssShowPlusMoins" && odiv.className != "ieclassrssShowPlusMoins")
 {
  e.style.white  = "gold";	
 
 
  if(window.ActiveXObject)  
   {
    odiv.className = "ieclassrssShowPlusMoins";
    odiv.style.top= document.body.scrollTop ;
    odiv.style.height= ( ( (window.screen.availHeight ) * 100) / window.screen.availHeight ) + "%";

   }
    else
   {
    odiv.className = "classrssShowPlusMoins";
    odiv.style.top= document.body.scrollTop ;
    odiv.style.height= ( ( (window.innerHeight - 10 ) * 100) / window.innerHeight ) + "%";

   }

 }
else
 {
  	
  if(window.ActiveXObject)  
   {
    odiv.className = "ieclassrss";
    odiv.style.top= document.body.scrollTop + 20;
//    odiv.style.height= ( ( (window.screen.availHeight) * 100) / window.screen.availHeight ) + "%";
 odiv.style.height= ( ( (window.screen.availHeight - 50 - 20) * 100) / window.screen.availHeight ) + "%"; 
   }
    else
   {
    odiv.className = "classrss";
    odiv.style.top= document.body.scrollTop + 20;
//    odiv.style.height= ( ( (window.innerHeight - 50 ) * 100) / window.innerHeight ) + "%";
    odiv.style.height= ( ( (window.innerHeight - 50 ) * 100) / window.innerHeight ) + "%";
   }
	
 }
/*
 if(window.ActiveXObject)
 {

  odiv.style.top= document.body.scrollTop;
  odiv.style.height= ( ( (window.screen.availHeight) * 100) / window.screen.availHeight ) + "%";
 }   
 else
 { 

 odiv.style.top= document.body.scrollTop;
 odiv.style.height= ( ( (window.innerHeight - 50 ) * 100) / window.innerHeight ) + "%";
 }
 
*/
}

function GetTypeUrl(nbresult)
{
//alert("nbresult2:"+nbresult);
//    PHPLOGOIFRSS = "http://www.singularite.info/src/logoifrss.php?&urlrss=";
 for(var i=TotalResult;i<(TotalResult + nbresult);i++)
 { 
var objfrm = document.getElementById("IFRMRSSOPML-" + i);
    var strurl = "http://www.singularite.info/src/logoifrss.php?&urlrss=" + document.getElementById("aurl-" +i).href;

if(objfrm)
objfrm.src= "http://www.singularite.info/src/logoifrss.php?&urlrss=" + strurl;
//objfrm.src= "http://www.singularite.info/src/logoifrss.php?&urlrss=http://www.singularite.info/rss.xml";
//$rss = "http://www.singularite.info/src/logoifrss.php?&urlrss=http://www.singularite.info/rss.xml";
/*
    var strurl = "http://www.singularite.info/src/logoifrss.php?&urlrss=" + document.getElementById("aurl-" +i).href;

   var str = 'tmsearch' + i + ' = setTimeout(\'getlogoifrss(\"'+escape(strurl)+'\",\"TDLOGORSSOPML-' + i + '\")\',' +  (i * 3000)  +  ',"javascript")'; 
    eval(str);
*/  
 document.getElementById("TXTAREA").value +=document.getElementById("aurl-" +i).href + "\n";
 }
}

function AddUrlRss(strsite)
{

MAX0HEIGHT = parseInt(document.getElementById("TDRIGHT").offsetHeight);    // declare dans index.js
scrTop0 = parseInt(document.body.scrollTop);    // declare dans index.js

window.parent.document.getElementById("IFRMFEED").src="src/listurlrss.php?&rss=" + window.parent.tabListRSS.length + "&urlrss=" + escape(strsite); 

var objdivshow =  document.getElementById("DIVMESSAGESHOWPLUSMOINS");
objdivshow.style.display = "block";
 try{ 
  var tm = setTimeout("javascript:document.getElementById('DIVMESSAGESHOWPLUSMOINS').style.display='none'",5000,"javascript");
 }catch(e){}
}
function AddSiteRss(strsite)
{
MAX0HEIGHT = parseInt(document.getElementById("TDRIGHT").offsetHeight);    // declare dans index.js
scrTop0 = parseInt(document.body.scrollTop);
//alert(document.body.scrollTop)
var scrTop = document.body.scrollTop;

//var tm= setTimeout("javascript:window.scrollTo(0," + scrTop + parseInt(document.getElementById('TDRIGHT').offsetHeight)  + ");",500,"javascript");
window.parent.document.getElementById("IFRMFEED").src = "";
window.parent.document.getElementById("IFRMFEED").src="src/listrss.php?&rss=" + window.parent.tabListRSS.length + "&site=" + escape(strsite); 



}
