//////////////////////////////////////////////////////////////////////////
//		JAVASCRIPT Inclusion function (JsINC)			//
//									//
//	Developed by Minh Nguyen Duong @ obie				//
//	http://obiewebsite.sourceforge.net						//
//									//
//	2003 Copyright (c) obie Websites. All right reserved		//
//									//
//	This Software is FREE and can be modified 			//
//	and redistributed under the condition that 			//
//	the copyright and information above stays 			//
//	intact and with the script.					//
//									//
//	If you redistribute this software, please link back		//
//	to http://obiewebsite.sourceforge.net					//
//									//
//////////////////////////////////////////////////////////////////////////
//	USAGE:								//
//	1 . Add this lines below to the middle of 			//
//	<HEAD> and </HEAD> tags :					//
//	==><script src="PATH_TO_JSINC/jsinc.js"></script>		//
//	2 . Add this line to anywhere that you want to show		//
//	the included page (eg: abc.txt)					//
//	==><script>setup_jsinc();</script>				//
//	3 . Command : include('abc.txt'); There are two ways to use:	//
//	==> <script>include('abc.txt');</script> OR			//
//	==> <A HREF="javascript:void(0)" ONCLICK="include('ABC.txt');">	//
//	link name</A> ==> with: ABC is the path to the file that	//
//	you want to include it to your webpage				//
//////////////////////////////////////////////////////////////////////////

var fl;
var s;


function stoperror(){
return true
}
window.onerror=stoperror;

function FileLoader (url, onload) {
  this.id = FileLoader.cnt;
  FileLoader.elements[FileLoader.cnt++] = this;
  this.url = url;
  this.onload = onload;
  this.createIFRAME();
  setTimeout('FileLoader.elements[' + this.id + '].loadDocument()', 5);
}
function FileLoader_createIFRAME () {
  this.frameName = 'FileLoader' + this.id;
  if (document.all) {
    var html = '';
    html += '<IFRAME ID="' + this.frameName + '"';
    html += ' NAME="' + this.frameName + '"';
    html += ' STYLE="display: none;"';
    html += ' SRC="about:Carregando....por favor, aguarde....">';
    html += '<\/IFRAME>';
    document.body.insertAdjacentHTML('beforeEnd', html);
  }

  //For other browsers that different to IE//

  else if (document.getElementById) {
  var ifr = document.createElement('IFRAME');
  ifr.id = ifr.name = this.frameName;
  ifr.style.visibility = 'visible'; // just for testing
  ifr.width = 300; ifr.height = 100;
  ifr.src = 'about:blank';
  document.body.appendChild(ifr);
  }
}
FileLoader.prototype.createIFRAME = FileLoader_createIFRAME;
function FileLoader_loadDocument (url) {
  if (url)
    this.url = url;
  this.loaded = false;
  this.document = null;
  var ifrWin = self.testfrm;
  var html = '';
  html += '<BODY ONLOAD="';
  html += 'var fl = top.FileLoader.elements[' + this.id + '];';
  html += 'fl.loaded = true;';
  html += 'fl.document = window.frames[0].document;';
  html += 'fl.onload(fl.document);';
  html += '"';
  html += '>';
  html += '<IFRAME SRC="' + this.url + '">';
  html += '<\/IFRAME>';
  html += '<\/BODY>';



ifrWin.self.document.open();
ifrWin.self.document.write(html);
ifrWin.self.document.close();
}
FileLoader.prototype.loadDocument = FileLoader_loadDocument;
FileLoader.cnt = 0;
FileLoader.elements = new Array();

function loadHandler (document) {
s=document.body.innerHTML;

window.status='Carregando a página incluída....';

self.jsinc.innerHTML=s;

window.status='Incluída com sucesso. OK';

}
function include(x){

self.jsinc.innerHTML='<b>Carregando....Por favor, aguarde....</b>';

fl = new FileLoader(x, loadHandler);
return false;
}
function setup_jsinc(){
document.write("<iframe name=testfrm src=\"about:blank\" width=0 height=0></iframe>");
document.write("<div id=jsinc></div>");
}
