//////////////////////////////////////////////////////////////////////
// Copyright 2003, Mawlana Faizani International (www.faizani.com) //
////////////////////////////////////////////////////////////////////	

function banner(img_source,alt,title,url,target) {
	this.img_source = img_source;
	this.alt = alt;
	this.title = title;
	this.url = url;
	this.target = target;
}

banners = new Array();
banners[0] = new banner("http://www.faizani.com/images/index_main.jpg",
                        "The school of faith and the death of Satan",
                        "The school of faith and the death of Satan",
						"http://www.faizani.com/books/1stG_chapters/schooloffaith.html",
						"");

banners[1] = new banner("http://www.faizani.com/images/index_main7.jpg",
	"Indeed, it is not the eyes that grow blind, but it is the Hearts, which are within the bosoms, that grow blind...",
	"Indeed, it is not the eyes that grow blind, but it is the Hearts, which are within the bosoms, that grow blind...",
                        "http://www.faizani.com/books/3rdG_chapters/qualities_heart.html",
						"");

banners[2] = new banner("http://www.faizani.com/images/index_main4.jpg",
	"The shortest path to relationship with Great God has been perfectly clarified to Muslims and even to all humanity...",
	"The shortest path to relationship with Great God has been perfectly clarified to Muslims and even to all humanity...",
                        "http://www.faizani.com/books/2ndG_chapters/2ndGoblet_Intro.html",
						"");
						
banners[3] = new banner("http://www.faizani.com/images/index_main2.jpg",
                        "The Utmost of Insight throughout Wisdom",
						"The Utmost of Insight throughout Wisdom",
                        "http://www.faizani.com/books/1stG_chapters/highestinsight.html",
						"");
						
var len = banners.length ;

function display_banner() {
	var i = Math.floor(4*Math.random());
	document.write('<a href="'+ banners[i].url + '" target="' + banners[i].target + '"><img src="' + banners[i].img_source + '" name="theImage" border=0 alt="' +banners[i].alt+ '"></A>');
	return banners[i];
}
function openwindow(url)
{
window.open(url,'demoWin','toolbar=0,location=no,directories=0,status=0,menubar=0,scrollbars=0,body topmargin=0,leftmargin=0,resizable=0,width=401,height=297');
}
function openwindow1(url)
{
window.open(url,'demoWin','toolbar=0,location=no,directories=0,status=0,menubar=0,scrollbars=0,body topmargin=0,leftmargin=0,resizable=0,width=425,height=440');
}

function openwindow2(url)
{
window.open(url,'demoWin','toolbar=0,location=no,directories=0,status=0,menubar=0,scrollbars=1,body topmargin=0,leftmargin=0,resizable=0,width=290,height=130');
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
// --> 


//////////////////////////////////////////////
//	DON'T TOUCH BELOW THIS LINE /////////
//////////////////////////////////////////////

document.write("<STYLE> \n .navlink {text-decoration: none} \n .navlink:hover {text-decoration: underline} \n </STYLE>")

function menu() {
   
   this.topics = new Array();
   this.color = 'blue';
   this.hcolor = 'purple';
   this.font = 'Arial,Verdana,Helvetica'
   this.fontsize= '1';
   this.subfontsize = '1';

   this.addTopic = addTopic;
   this.addSubtopic = addSubtopic;
   this.display = display;
   this.oneLine = oneLine;
   this.displayNavTable = displayNavTable;   
}

function addTopic(tname,url,index) {
   if (arguments.length != 3) { alert("Because of bad syntax, " + arguments[0] + " was not added."); return false }
   if (this.topics[index]) {alert("You overwrote " + this.topics[index][0].toUpperCase() + " with " + tname.toUpperCase()); }
   if (index) {this.topics[index] = new Array(tname, url); }
   else { alert("Please specify an index for " + tname); } 
}

function addSubtopic(sname,url,tindex,sindex) {
   if (arguments.length != 4) {alert('Your subtopic syntax for ' + arguments[0] + ' is wrong');return}
   if (!this.topics[tindex]["subtopics"]) { 
	this.topics[tindex]["subtopics"] = new Array();  
   }
   this.topics[tindex]["subtopics"][sindex] = new Array(sname,url);   
}

function oneLine(topic,stopic) {
   if (arguments.length == 2) { document.write(this.topics[topic]["subtopics"][stopic][0]) }
   else if (arguments.length == 1) { document.write(this.topics[topic][0]) }
   else {alert("Wrong number of arguments in oneLine");return}
}

function oneLineLink(topic,stopic) {
   if (arguments.length == 2) { document.write("<A HREF='" + this.topics[topic]["subtopics"][stopic][1] + "'>" + this.topics[topic]["subtopics"][stopic][0]+"</A>") }
   else if (arguments.length == 1) { document.write("<A HREF='" + this.topics[topic][1] + "'>" + this.topics[topic][0]+"</A>") }
   else {alert("Wrong number of arguments in oneLine");return}
}

function display(htopic,hsubtopic) {
   for (i=0;i<this.topics.length;i++) { 		// until highest topic index
     if (this.topics[i]) { 				// if topic index has a value
	document.write("<FONT SIZE=1><BR></FONT>"); 			// add break between topics
	if (i == htopic && !hsubtopic) { document.write("<A HREF='" + this.topics[i][1] + "' CLASS='navlink'><FONT FACE='" + this.font + "' COLOR=" + this.hcolor + " SIZE = " + this.fontsize +">" + this.topics[i][0] + "</A></FONT><BR>") }   //{ document.write("<FONT FACE='" + this.font + "' COLOR=" + this.hcolor + " SIZE = " + this.fontsize + ">" + this.topics[i][0] + "</FONT><BR>") }  // if this is the topic to be highlighted, and there is no subtopic to be highlighted 	   
	else if (this.topics[i][1] == null) { document.write("<FONT FACE='" + this.font + "' COLOR=" + this.color + " SIZE = " + this.fontsize +">" + this.topics[i][0] + "</FONT><BR>") }
	else { document.write("<A HREF='" + this.topics[i][1] + "' CLASS='navlink'><FONT FACE='" + this.font + "' COLOR=" + this.color + " SIZE = " + this.fontsize +">" + this.topics[i][0] + "</A></FONT><BR>") }
	if (i == htopic  && this.topics[i]["subtopics"]) {		// if that topic has subtopics
	   for (j=0;j<this.topics[i]["subtopics"].length;j++) {	// until highest subtopic index
		if (this.topics[i]["subtopics"][j]) {		// if that subtopic has a value
	      	   if (j == hsubtopic) {document.write("<FONT FACE='" + this.font + "' COLOR=" + this.color + " SIZE = " + this.subfontsize + ">&nbsp;&nbsp;&nbsp;-</FONT><A HREF='" + this.topics[i]["subtopics"][j][1] + "' CLASS='navlink'><FONT FACE='" + this.font + "' COLOR=" + this.hcolor + " SIZE = " + this.subfontsize + ">" + this.topics[i]["subtopics"][j][0] + "</A></FONT><BR>")}   // {document.write("<FONT FACE='" + this.font + "' COLOR=" + this.hcolor + " SIZE = " + this.subfontsize + ">&nbsp;&nbsp;&nbsp;-" + this.topics[i]["subtopics"][j][0] + "</FONT><BR>")}
		   else {document.write("<FONT FACE='" + this.font + "' COLOR=" + this.color + " SIZE = " + this.subfontsize + ">&nbsp;&nbsp;&nbsp;-</FONT><A HREF='" + this.topics[i]["subtopics"][j][1] + "' CLASS='navlink'><FONT FACE='" + this.font + "' COLOR=" + this.color + " SIZE = " + this.subfontsize + ">" + this.topics[i]["subtopics"][j][0] + "</A></FONT><BR>")}
		}	
	   }
	}
     }
   }
} 


function displayNavTable() {
   for (i=0;i<this.topics.length;i++) { 		// until highest topic index
     if (this.topics[i]) { 				// if topic index has a value
	document.write("<NOBR><FONT COLOR=BLUE><B>" +this.topics[i][0] + "</B></FONT> has index of " + i + " and URL of <B>" + this.topics[i][1] + "</B></NOBR><BR>")
        if (this.topics[i]["subtopics"]) {		// if that topic has subtopics
	   for (j=0;j<this.topics[i]["subtopics"].length;j++) {	// until highest subtopic index
		if (this.topics[i]["subtopics"][j]) {		// if that subtopic has a value
	      	   document.write("<NOBR>&nbsp;&nbsp;&nbsp;<FONT COLOR=RED><B>" + this.topics[i]["subtopics"][j][0] + "</B></FONT> has subindex of " + j + " and URL of <B>" + this.topics[i]["subtopics"][j][1] + "</B></NOBR><BR>")
		}
     	   }
	}
     }
   } 
}
