// Universal Related Select Menus - cascading popdown menus
// (Dynamically-sized related menus using JS 1.1's new Option cmd)
// by Andrew King. v1.33 19990715
// Copyright (c) 1999 internet.com LLC. All Rights Reserved.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
//
// Originally published and documented at http://www.webreference.com
// Contact aking@internet.com for all other uses.
//
// 3-3-96 code optimized, modularized, and made universal-abk
// 3-8-97 jumpPage1 and 2 consolidated into generalized func
// 3-10-97 changeMenu added jumpPage(0,0), for non-ns3 browsers
// make popup act like a live popup when no related functionality
// 8-5-97 browser detect script changed to check for option functionality
// 9-11-97 aln changed to options.length, as IE 4 does not support
// nulling out options
// 12-22-98 added SIZE att to make select lists, used named forms/elements
// 1-1-99 added getFormNum to fix netscape 2 bug (doesn't support named fms)
//  pass formName, elementNum to relate and jmp as workaround
//  pass this.form,0 and increment instead of decrement in relate to get 
//   next form
//  assumes menu2 follows menu1 in HTML
// tested in mac ie3.01/ns2.02 (live), ns 3.01,4.05,4.5 and ie4.01 related
// 990701 - fixed back button bug in ie4+ by resetting all forms onload-abk
//    thanks to peter belesis (pbel@internet.com) for this fix
// 990714 - added IE5 persistence - abk pb, note this vers bombs gecko
//  use the newer vers on next page, intro2.html
// 990715 - went open source, created stipped down example files - abk
// 990720 - jmp() fix getFormNum(formName);->
//     var formNum = getFormNum(formName);
// 990722 - var for scope added, jmp chgd to named form for ns2.02 bug-abk

if(v){a=new Array(22);aln=22;}

function getFormNum (formName) {
	var formNum =-1;
	for (i=0;i<document.forms.length;i++){
		tempForm = document.forms[i];
		if (formName == tempForm) {
			formNum = i;
			correctForm = tempForm;
			break;
		}
	}
	return formNum;
}

function jmp(form, elt)
// The first parameter is a reference to the form.
{
	if (form != null) {
		with (form.elements[elt]) {
			if (0 <= selectedIndex)
				parent.major.location = options[selectedIndex].value;
		}
	}
}


function O(txt,url) {
a[k]=new Option(txt,url);k++;
}
function relate(formName,elementNum,j) {
if(v){
k=1;
if(j==0){
parent.major.location = "main.htm";
a=new Array(1);
O("العناوين الفرعية لما تختاره في القائمة الأولى","main.htm");
}
if(j==1){
parent.major.location = "inside/1.htm";
a=new Array(2);
O("التقليد","inside/1.htm");
O("أقسام الاحتياط","inside/2.htm");
}
if(j==2){
parent.major.location = "inside/3.htm";
a=new Array(38);
O("الطهارة","inside/3.htm");
O("الوضوء","inside/4.htm");
O("شرائط الوضوء","inside/5.htm");
O("نواقض الوضوء","inside/6.htm");
O("موارد وجوب الوضوء","inside/7.htm");
O("الغسل","inside/8.htm");
O("غسل الجنابة","inside/9.htm");
O("كيفية الغسل","inside/10.htm");
O("شرائط الغسل","inside/11.htm");
O("الحيض وشرائطه","inside/12.htm");
O("اقسام الحائض","inside/13.htm");
O("احكام ذات العادة","inside/14.htm");
O("احكام المبتدئة والمضطربة","inside/15.htm");
O("احكام الناسية للعادة","inside/16.htm");
O("احكام الحائض","inside/17.htm");
O("النفاس","inside/18.htm");
O("الاستحاضة","inside/19.htm");
O("اقسام الاستحاضة واحكامها","inside/20.htm");
O("احكام الميت وغسله","inside/21.htm");
O("شرائط المُغَسّل","inside/22.htm");
O("كيفية تغسيل الميت","inside/23.htm");
O("تكفين الميت","inside/24.htm");
O("شروط الكفن","inside/25.htm");
O("الحنوط","inside/26.htm");
O("الصلاة على الميت","inside/27.htm");
O("كيفية صلاة الميت","inside/28.htm");
O("دفن الميت","inside/29.htm");
O("صلاة ليلة الدفن","inside/30.htm");
O("غسل مس الميت","inside/31.htm");
O("الاغسال المستحبة","inside/32.htm");
O("احكام الجبائر","inside/33.htm");
O("التيمم","inside/34.htm");
O("ما يصح به التيمم","inside/35.htm");
O("كيفية التيمم وشرائطه","inside/36.htm");
O("احكام دائم الحدث","inside/37.htm");
O("النجاسات واحكامها","inside/38.htm");
O("ما تثبت به الطهارة والنجاسة","inside/39.htm");
O("المطهرات","inside/40.htm");
}
if(j==3){
parent.major.location = "inside/41.htm";
a=new Array(5);
O("الوقت","inside/41.htm");
O("القبلة","inside/42.htm");
O("الطهارة في الصلاة","inside/43.htm");
O("مكان المصلي","inside/44.htm");
O("لباس المصلي","inside/45.htm");
O("شرائط لباس المصلي","inside/46.htm");
}
if(j==4){
parent.major.location = "inside/47.htm";
a=new Array(34);
O("الصلاة","inside/47.htm");
O("صلاة الجمعة","inside/48.htm");
O("النوافل اليومية","inside/49.htm");
O("الأذان والاقامة","inside/50.htm");
O("أجزاء الصلاة و واجباتها","inside/51.htm");
O("تكبيرة الاحرام","inside/52.htm");
O("القراءة","inside/53.htm");
O("الركوع","inside/54.htm");
O("واجبات الركوع","inside/55.htm");
O("السجود","inside/56.htm");
O("التشهد","inside/57.htm");
O("السلام","inside/58.htm");
O("الترتيب والموالاة","inside/59.htm");
O("القنوت","inside/60.htm");
O("مبطلات الصلاة","inside/61.htm");
O("احكام الشك في الصلاة","inside/62.htm");
O("الشك في عددالركعات","inside/63.htm");
O("الشكوك التي لا يعتني بها في الصلاة","inside/64.htm");
O("صلاة الاحتياط","inside/65.htm");
O("قضاء الاجزاء المنسية","inside/66.htm");
O("سجود السهو","inside/67.htm");
O("صلاة الجماعة","inside/68.htm");
O("موارد مشروعية الجماعة","inside/69.htm");
O("شرائط الامامة","inside/70.htm");
O("شرائط صلاة الجماعة","inside/71.htm");
O("أحكام صلاة الجماعة","inside/72.htm");
O("أحكام صلاة المسافر","inside/73.htm");
O("قواطع السفر","inside/74.htm");
O("أحكام الصلاة في السفر","inside/75.htm");
O("التخير بين القصر والاتمام","inside/76.htm");
O("قضاء الصلاة","inside/77.htm");
O("صلاة الاستيجار","inside/78.htm");
O("صلاة الآيات","inside/79.htm");
}
if(j==5){
parent.major.location = "inside/80.htm";
a=new Array(7);
O("الصوم وشرائط وجوبه","inside/80.htm");
O("ثبوت الهلال في شهر رمضان","inside/81.htm");
O("نية الصوم","inside/82.htm");
O("المفطرات","inside/83.htm");
O("أحكام المفطرات","inside/84.htm");
O("موارد وجوب القضاء","inside/85.htm");
O("أحكام القضاء","inside/86.htm");
}
if(j==6){
parent.major.location = "inside/87.htm";
a=new Array(9);
O("زكاة الاموال","inside/87.htm");
O("زكاة الحيوان","inside/88.htm");
O("زكاة النقدين","inside/89.htm");
O("زكاة الغلات الاربع","inside/90.htm");
O("زكاة مال التجارة","inside/91.htm");
O("أحكام الزكاة","inside/92.htm");
O("موارد صرف الزكاة","inside/93.htm");
O("زكاة الفطرة","inside/94.htm");
O("مقدار الفطرة ونوعها","inside/95.htm");
}
if(j==7){
parent.major.location = "inside/96a.htm";
a=new Array(3);
O("أحكام الخمس","inside/96a.htm");
O("مستحق الخمس","inside/96.htm");
O("سهم الامام عليه السلام","inside/97.htm");
}
if(j==8){
parent.major.location = "inside/98.htm";
a=new Array(35);
O("أحكام التجارة","inside/98.htm");
O("المعاملات المكروهة","inside/99.htm");
O("المعاملات المحرمة","inside/100.htm");
O("شرائط المتبائعين","inside/101.htm");
O("شرائط العوضين","inside/102.htm");
O("عقد البيع","inside/103.htm");
O("بيع الثمار","inside/104.htm");
O("النقد والنسيئة","inside/105.htm");
O("بيع السلف","inside/106.htm");
O("شرائط بيع السلف","inside/107.htm");
O("أحكام بيع السلف","inside/108.htm");
O("بيع النقدين","inside/109.htm");
O("الخيارات","inside/110.htm");
O("خاتمة في الاقالة","inside/111.htm");
O("أحكام الشفعة","inside/112.htm");
O("أحكام الشركة","inside/113.htm");
O("أحكام الصلح","inside/114.htm");
O("أحكام الاجارة","inside/115.htm");
O("شرائط المنفعة المقصودة من الاجارة","inside/116.htm");
O("مسائل في الاجارة","inside/117.htm");
O("أحكام الجعالة","inside/118.htm");
O("أحكام المزارعة","inside/119.htm");
O("أحكام المضاربة","inside/120.htm");
O("أحكام المساقاة","inside/121.htm");
O("أحكام الحجر","inside/122.htm");
O("أحكام الوكالة","inside/123.htm");
O("أحكام القرض","inside/124.htm");
O("أحكام الحوالة","inside/125.htm");
O("أحكام الرهن","inside/126.htm");
O("أحكام الضمان","inside/127.htm");
O("أحكام الكفالة","inside/128.htm");
O("أحكام الوديعة","inside/128b.htm");
O("أحكام العارية","inside/129.htm");
O("أحكام الهبة","inside/130.htm");
O("أحكام الاقرار","inside/131.htm");
}
if(j==9){
parent.major.location = "inside/133.htm";
a=new Array(10);
O("أحكام النكاح","inside/133.htm");
O("أحكام العقد","inside/134.htm");
O("صيغة العقد الدائم","inside/135.htm");
O("صيغة العقد غير الدائم","inside/136.htm");
O("شرائط العقد","inside/137.htm");
O("موجبات خيار الفسخ من العيب والتدليس","inside/138.htm");
O("أسباب التحريم","inside/139.htm");
O("أحكام العقد الدائم","inside/140.htm");
O("النكاح المنقطع","inside/141.htm");
O("مسائل متفرقة في النكاح","inside/142.htm");
}
if(j==10){
parent.major.location = "inside/143.htm";
a=new Array(3);
O("أحكام الرضاع","inside/143.htm");
O("الرضاع وآدابه","inside/144.htm");
O("مسائل متفرقة في الرضاع","inside/145.htm");
}
if(j==11){
parent.major.location = "inside/146.htm";
a=new Array(7);
O("أحكام الطلاق","inside/146.htm");
O("عدة الطلاق","inside/147.htm");
O("الطلاق البائن والرجعي","inside/148.htm");
O("الرجعة وحكمها","inside/149.htm");
O("الطلاق الخلعي","inside/150.htm");
O("المباراة وحكمها","inside/151.htm");
O("مسائل متفرقة في الطلاق","inside/152.htm");
}
if(j==12){
parent.major.location = "inside/153.htm";
a=new Array(1);
O("أحكام الغصب","inside/153.htm");
}
if(j==13){
parent.major.location = "inside/154.htm";
a=new Array(1);
O("أحكام اللقطة","inside/154.htm");
}
if(j==14){
parent.major.location = "inside/155.htm";
a=new Array(9);
O("أحكام الذباحة","inside/155.htm");
O("كيفية الذبح","inside/156.htm");
O("شرائط الذبح","inside/157.htm");
O("نحر الابل","inside/158.htm");
O("آداب الذباحة والنحر","inside/159.htm");
O("مكروهات الذباحة والنحر","inside/160.htm");
O("أحكام الصيد بالسلاح","inside/161.htm");
O("حكم الصيد بالكلب","inside/162.htm");
O("صيد السمك والجراد","inside/163.htm");
}
if(j==15){
parent.major.location = "inside/164.htm";
a=new Array(2);
O("أحكام الاطعمة والاشربة","inside/164.htm");
O("آداب الاكل والشرب","inside/165.htm");
}
if(j==16){
parent.major.location = "inside/166.htm";
a=new Array(3);
O("أحكام النذر","inside/166.htm");
O("العهد وحكمه","inside/167.htm");
O("اليمين وحكمها","inside/168.htm");
}
if(j==17){
parent.major.location = "inside/169.htm";
a=new Array(1);
O("أحكام الوقف","inside/169.htm");
}
if(j==18){
parent.major.location = "inside/170.htm";
a=new Array(1);
O("أحكام الوصية","inside/170.htm");
}
if(j==19){
parent.major.location = "inside/171.htm";
a=new Array(1);
O("أحكام الكفارات","inside/171.htm");
}
if(j==20){
parent.major.location = "inside/172.htm";
a=new Array(6);
O("أحكام الاٍرث","inside/172.htm");
O("اٍرث الطبقة الاولى","inside/173.htm");
O("اٍرث الطبقة الثانية","inside/174.htm");
O("اٍرث الطبقة الثالثة","inside/175.htm");
O("اٍرث الزوج والزوجة","inside/176.htm");
O("مسائل متفرقة في الاٍرث","inside/177.htm");
}
aln2=a.length;
var formNum = getFormNum(formName); // var formNum added, explicit var pass
if (formNum>=0) {
	formNum++; // reference next form, assume it follows in HTML
	with (document.forms[formNum].elements[elementNum]) {
		for (var i=options.length-1;i>0;i--) options[i]=null;
		for (var i=1;i<aln2;i++) options[i-1]=a[i];
		options[0].selected=true;
	}
}
} else {
jmp(formName,elementNum);
}
}

// BACK BUTTON FIX for ie4+- or
// MEMORY-CACHE-STORING-ONLY-INDEX-AND-NOT-CONTENT
//
// from peter belesis:
// IE4+ remembers the index of each SELECT but NOT the CONTENTS of each
// SELECT, so it gets it wrong.
//
// it has to do with MEMORY CACHE (where form input is stored) and how
// IE stores information about SELECT menus.
//
// IE stores the selectedINDEX ONLY of the SELECT menu, not the
// CONTENTS-AT-THE-TIME-OF-SELECTION
//
// when we return to a page, it displays the default contents of each
// SELECT, grabs the stored index from cache and aligns the default
// contents to that index.
// 
// Netscape, on the other hand, seems to remember both INDEX and CONTENTS
// added ie5 persistence 990714

function IEsetup(){
	if(!document.all) return;
	IE5 = navigator.appVersion.indexOf("5.")!=-1;
	if(!IE5) {
		for (i=0;i<document.forms.length;i++) {
			document.forms[i].reset();
		}
	}
}

window.onload = IEsetup;
