// JavaScript Document





link1_off= new Image;

link1_off.src="images/links/link1.gif";

link1_on= new Image;

link1_on.src="images/links/link1-on.gif";

//------------------------------------

link2_off= new Image;

link2_off.src="images/links/link2.gif";

link2_on= new Image;

link2_on.src="images/links/link2-on.gif";

//------------------------------------

link3_off= new Image;

link3_off.src="images/links/link3.gif";

link3_on= new Image;

link3_on.src="images/links/link3-on.gif";

//------------------------------------

link4_off= new Image;

link4_off.src="images/links/link4.gif";

link4_on= new Image;

link4_on.src="images/links/link4-on.gif";

//------------------------------------

link5_off= new Image;

link5_off.src="images/links/link5.gif";

link5_on= new Image;

link5_on.src="images/links/link5-on.gif";

//------------------------------------

link6_off= new Image;

link6_off.src="images/links/link6.gif";

link6_on= new Image;

link6_on.src="images/links/link6-on.gif";

//------------------------------------

link7_off= new Image;

link7_off.src="images/links/link7.gif";

link7_on= new Image;

link7_on.src="images/links/link7-on.gif";

//------------------------------------

link8_off= new Image;

link8_off.src="images/links/link8.gif";

link8_on= new Image;

link8_on.src="images/links/link8-on.gif";

//------------------------------------

link9_off= new Image;

link9_off.src="images/links/link9.gif";

link9_on= new Image;

link9_on.src="images/links/link9-on.gif";

//------------------------------------

link10_off= new Image;

link10_off.src="images/links/link10.gif";

link10_on= new Image;

link10_on.src="images/links/link10-on.gif";

//------------------------------------

link11_off= new Image;

link11_off.src="images/links/link11.gif";

link11_on= new Image;

link11_on.src="images/links/link11-on.gif";

//------------------------------------

link12_off= new Image;

link12_off.src="images/links/link12.gif";

link12_on= new Image;

link12_on.src="images/links/link12-on.gif";

//------------------------------------

link13_off= new Image;

link13_off.src="images/links/link13.gif";

link13_on= new Image;

link13_on.src="images/links/link13-on.gif";

//------------------------------------

link14_off= new Image;

link14_off.src="images/links/link14.gif";

link14_on= new Image;

link14_on.src="images/links/link14-on.gif";

//------------------------------------

link15_off= new Image;

link15_off.src="images/links/link15.gif";

link15_on= new Image;

link15_on.src="images/links/link15-on.gif";

//------------------------------------

link16_off= new Image;

link16_off.src="images/links/link16.gif";

link16_on= new Image;

link16_on.src="images/links/link16-on.gif";

//------------------------------------

link17_off= new Image;

link17_off.src="images/links/link17.gif";

link17_on= new Image;

link17_on.src="images/links/link17-on.gif";

//------------------------------------

link18_off= new Image;

link18_off.src="images/links/link18.gif";

link18_on= new Image;

link18_on.src="images/links/link18-on.gif";

//------------------------------------

link19_off= new Image;

link19_off.src="images/links/link19.gif";

link19_on= new Image;

link19_on.src="images/links/link19-on.gif";

//------------------------------------

link20_off= new Image;

link20_off.src="images/links/link20.gif";

link20_on= new Image;

link20_on.src="images/links/link20-on.gif";

//------------------------------------

//------------------------------------

link21_off= new Image;

link21_off.src="images/links/link21.gif";

link21_on= new Image;

link21_on.src="images/links/link21-on.gif";

//------------------------------------

link22_off= new Image;

link22_off.src="images/links/link22.gif";

link22_on= new Image;

link22_on.src="images/links/link22-on.gif";

//------------------------------------

//------------------------------------

function swap(img1, img2)

{

	document.images[img1].src=eval(img2+".src");

}



//------------------------------------

function swap2(img1, img2, LayerName)

{

	if (LayerName.style.display=='none')

		{

			document.images[img1].src=eval(img2+".src");		

		}		

}



//------------------------------------

function ShowLayer(LayerName, img0)

{

	if (LayerName.style.display=='none')

		{

		LayerName.style.display='';

		document.images[img0].src=eval(img0+"_on.src");

		}

	else

		{

		LayerName.style.display='none';

		document.images[img0].src=eval(img0+"_off.src");		

		}	

}



//------------------------------------

function submitGuestForm()	

	{

	if (frmGuest.txtName.value=="")

		alert ("الرجاء كتابة الاسم!");

	else if (frmGuest.txtEmail.value=="")

		alert ("!الرجاء كتابة البريد الإلكتروني!");
  
    else if (frmGuest.txtEmail.value.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1)

		alert (" الرجاء التأكد من البريد الإلكتروني!");
  
   else if (frmGuest.txtHomepage.value=="")
   
		alert (" الرجاء كتابة رقم هاتفك!");

	else if (frmGuest.txtComments.value=="")

		alert ("الرجاء كتابة تعليقك!");

	else

		return true;

	return false;

	}



//------------------------------------

function submitContactForm()	

	{

	if (frmContact.txtName.value=="")

		alert ("!الرجاء كتابة الاسم");

	else if (frmContact.txtEmail.value=="")

		alert ("!الرجاء كتابة البريد الإلكتروني");

	else if (frmContact.txtComments.value=="")

		alert ("!الرجاء كتابة تعليقك");

	else

		return true;

	return false;

	}



//------------------------------------

function submitMasaelForm()	

	{

	if (frmMasael.txtName.value=="")

		alert ("!الرجاء كتابة الاسم");

	else if (frmMasael.txtEmail.value=="")

		alert ("!الرجاء كتابة البريد الإلكتروني");

	else if (frmMasael.txtQuestion.value=="")

		alert ("!الرجاء كتابة نص السؤال");

	else if (frmMasael.txtMoqalad.value=="")

		alert ("!الرجاء ذكر اسم مرجع التقليد");

	else

		return true;

	return false;

	}



//------------------------------------

function submitLectureForm()	

	{

	if (frmLecture.txtTitle.value=="")

		alert ("!الرجاء كتابة العنوان")

	else if (frmLecture.txtType.value=="0")

		alert ("!اختر القسم الفرعي المناسب")

	else if (frmLecture.txtEnDate.value=="")

		alert ("!الرجاء كتابة التاريخ الميلادي")

	else if (frmLecture.txtSummary.value=="")

		alert ("!الرجاء كتابة الملخص")

	else if (frmLecture.txtDetails.value=="")

		alert ("!الرجاء كتابة التفاصيل")

	else

		return true; 

	return false;

	}



//------------------------------------



function goCat()

	{

	url = "?start=0&cat=" + frmCats.mainCats.options(frmCats.mainCats.selectedIndex).value;

	window.location = url;

	}





//------------------------------------

function printThis(lecID)

	{

		var w = 550;

		var h=364;		

		var winl = (screen.width - w) / 2;

		var wint = (screen.height - h) / 2;

		winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars=1,resizable=0'

		winurl = 'print.php?id=' + lid

		win = window.open(winurl, 'mywindow', winprops)

	}



//------------------------------------

function submitSendForm()	

	{

	if (frmSend.txtFromName.value=="")

		alert ("!الرجاء كتابة اسمك")

	else if (frmSend.txtFromEmail.value=="")

		alert ("!الرجاء كتابة بريدك الإلكتروني")

	else if (frmSend.txtToName.value=="")

		alert ("!الرجاء كتابة اسم صديقك")

	else if (frmSend.txtToEmail.value=="")

		alert ("!الرجاء كتابة بريد صديقك")

	else

		return true; 

	return false;

	}



//------------------------------------

function submitListForm()

	{

	if (frmList.txtEmail.value=="")

		alert ("!الرجاء كتابة بريدك الإلكتروني")

	else

		return true; 

	return false;		

	}

	

//------------------------------------

function submitAnswerForm()

	{

	if (frmAnswer.txtTitle.value=="")

		alert ("!الرجاء كتابة عنوان السؤال")

	else if (frmAnswer.txtQuestion.value=="")

		alert ("!الرجاء ذكر السؤال")

	else if (frmAnswer.txtAnswer.value=="")

		alert ("!الرجاء ذكر الجواب")

	else if (frmAnswer.txtType.value=="0")

		alert ("!الرجاء اختيار التصنيف المناسب")

	else

		return true; 

	return false;		

	}



//-------------------------------------

function disableIt(obj)

{

	obj.disabled = !(obj.disabled);

	var z = (obj.disabled) ? 'disabled' : 'enabled';

}



//------------------------------------

function submitMainCat()

	{

	if (frmMain.txtNameMain.value=="")

		alert ("!الرجاء كتابة اسم التصنيف")

	else

		return true; 

	return false;		

	}



//------------------------------------

function submitSubCat()

	{

	if (frmSub.txtNameSub.value=="")

		alert ("!الرجاء كتابة اسم التصنيف")

	else if (frmSub.txtSubCat.value=="0")

		alert ("!الرجاء اختيار التصنيف الفرعي")

	else

		return true; 

	return false;		

	}





//----------------------------------

function submitMainDel()

	{

	if (frmMain.txtCat2.value=="0")

		alert ("!الرجاء اختيار التصنيف")

	else

		return true; 

	return false;		

	}



//----------------------------------

function submitSubDel()

	{

	if (frmSub.txtCat2.value=="0")

		alert ("!الرجاء اختيار التصنيف الفرعي")

	else

		return true; 

	return false;		

	}



//----------------------------------

function submitDelForm()

	{

	if (frmDel.txtCat.value=="0")

		alert ("!الرجاء اختيار التصنيف المناسب")

	else

		return true; 

	return false;		

	}



//----------------------------------

function submitBookForm()

	{

	if (frmBook.txtName.value=="")

		alert ("!الرجاء كتابة اسم الكتاب")

	else if (frmBook.txtPhoto.value=="")

		alert ("!الرجاء ذكر غلاف الكتاب")

	else if (frmBook.txtSrc.value=="")

		alert ("!الرجاء ذكر رابط الكتاب")

	else

		return true; 

	return false;		

	}





//------------------------------------

function trim(value) {

   var temp = value;

   var obj = /^(\s*)([\W\w]*)(\b\s*$)/;

   if (obj.test(temp)) { temp = temp.replace(obj, '$2'); }

   var obj = /  /g;

   while (temp.match(obj)) { temp = temp.replace(obj, " "); }

   return temp;

}



//------------------------------------

function submitSearchForm()

	{

	searchBox = frmSearch.txtKeyWord

	if (searchBox.value=="")

		alert ("الرجاء كتابة كلمة البحث")

	else if (trim(searchBox.value) == " ")

		alert ("الرجاء كتابة كلمة بحث كاملة")

	else if (trim(searchBox.value).length < 4)

		alert ("الرجاء كتابة كلمة بحث كاملة")

	else

		return true; 

	searchBox.value="";

	searchBox.focus();

	return false;			

	}



//------------------------------------

function goMediaCat()

	{

	url = "?start=0&cat=" + frmMediaCats.mainCats.options(frmMediaCats.mainCats.selectedIndex).value;

	window.location = url;

	}



//------------------------------------

function delMedia(id)

	{	

	response = confirm("هل تريد فعلاً حذف هذه المحاضرة/الدعاء؟");

	if (response) window.location = '?action=del&id=' + id;

	}



//----------------------------------

function submitMediaForm()

	{

	if (frmMedia.txtName.value=="")

		alert ("!الرجاء كتابة الاسم")

	else if (frmMedia.txtCat.value==0)

		alert ("!الرجاء اختيار التصنيف")

	else if (frmMedia.txtLen.value=="")

		alert ("!الرجاء ذكر المدة")

	else

		return true; 

	return false;		

	}





//---------------------------mailling list



//------------------------------------

function goListCat()

	{	

	url = "?start=0&cat=" + frmListCats.listCats.options(frmListCats.listCats.selectedIndex).value;

	window.location = url;

	}





//------------------------------------

function delUser(usrID, start, cat)

	{

	response = confirm("هل تريد فعلاً حذف هذا المشترك؟");

	if (response) window.location = "?id=" + usrID + "?>&start=" + start + "&action=del&cat=" + cat

	}



//------------------------------------

function selectAll()

	{

		if (document.frmMsg.chkAll.checked)

			{

				document.frmMsg.chkSub.checked = true;

				document.frmMsg.chkMale.checked = true;

				document.frmMsg.chkFemale.checked = true;

			}

		else if (document.frmMsg.chkFemale.checked && document.frmMsg.chkMale.checked && document.frmMsg.chkSub.checked)

				document.frmMsg.chkAll.checked = true;

			

	}



//------------------------------------

function deSelectAll(check)

	{

			if (check.checked==false)

				document.frmMsg.chkAll.checked = false;

			else if (document.frmMsg.chkFemale.checked && document.frmMsg.chkMale.checked && document.frmMsg.chkSub.checked)

				document.frmMsg.chkAll.checked = true;				

	}



//------------------------------------

function submitMsgForm()

	{

		if (! (frmMsg.chkAll.checked || frmMsg.chkSub.checked || frmMsg.chkMale.checked || frmMsg.chkFemale.checked) )

			alert ("! الرجاء اختيار الفئة التي تود الإرسال إليها");

		else if (frmMsg.txtTitle.value=="")

			alert ("! الرجاء ذكر عنوان الرسالة");

		else if (frmMsg.txtDetails.value=="")

			alert ("! الرجاء ذكر نص الرسالة");

		else

			return true;

		return false;

	}



//------------------------------------

function delMsg(msgID, start)

	{

	response = confirm("هل تريد فعلاً حذف هذه الرسالة من الأرشيف؟");

	if (response) window.location = "?id=" + msgID + "?>&start=" + start + "&action=del"

	}

//---------------------------- end mailling list





//------------------------------------

function submiteventsForm()	

	{

	if (frmevents.txtFromName.value=="")

		alert ("!الرجاء كتابة الفعالية")

	else if (frmevents.txtFromPleace.value=="")

		alert ("!الرجاء كتابة مكان الفعالية")

	else if (frmevents.txtTime.value=="")

		alert ("!الرجاء كتابة وقت الفعالية")

	else if (frmevents.txtDate.value=="")

		alert ("!الرجاء كتابة تاريخ الفعالية")

	else

		return true; 

	return false;

	}



//--------------------------------------

function delEvents(id)

	{	

	response = confirm("محمد هل تريد فعلاً حذف هذه الفعالية؟");

	if (response) window.location = '?action=del&eventsID=' + id;

	}



	

//------------------------------------

function submitGallerycatForm()	

	{

	if (frmGallerycat.txtName.value=="")

		alert ("!الرجاء كتابة إسم المجموعة")

else

		return true; 

	return false;

	}

//------------------------------------

function editGallerycat(id, name, date, details)

	{

		

		document.frmGallerycat.txtDetails.value=details;		

		document.frmGallerycat.txtDate.value=date;

		document.frmGallerycat.txtName.value=name;

		document.frmGallerycat.txtID.value=id;

		document.frmGallerycat.btnSubmit.value='تحديث';

	}

//------------------------------------

function delGallerycat(id)

	{	

	response = confirm("هل تريد فعلاً حذف هذه المجموعة؟");

	if (response) window.location = '?action=del&ID=' + id;

	}

//------------------------------------

function editGallery(id, file, commant, date)

	{

	    document.frmGallery.txtDate.value=date;

		document.frmGallery.txtCommant.value=commant;

		document.frmGallery.txtFile.value=file;

		document.frmGallery.txtID.value=id;

		document.frmGallery.btnSubmit.value='تحديث';

	}

//------------------------------------

function delGallery(id)

	{	

	response = confirm("هل تريد فعلاً حذف هذه الصورة؟");

	if (response) window.location = '?action=del&ID=' + id;

	}

	

