// JavaScript Document
link0_off = new Image;
link0_off.src = "img/link0.gif";
link0_on = new Image;
link0_on.src = "img/link0on.gif";
link1_off = new Image;
link1_off.src = "img/link1.gif";
link1_on = new Image;
link1_on.src = "img/link1on.gif";
link2_off = new Image;
link2_off.src = "img/link2.gif";
link2_on = new Image;
link2_on.src = "img/link2on.gif";
link3_off = new Image;
link3_off.src = "img/link3.gif";
link3_on = new Image;
link3_on.src = "img/link3on.gif";
link4_off = new Image;
link4_off.src = "img/link4.gif";
link4_on = new Image;
link4_on.src = "img/link4on.gif";
link5_off = new Image;
link5_off.src = "img/link5.gif";
link5_on = new Image;
link5_on.src = "img/link5on.gif";
link6_off = new Image;
link6_off.src = "img/link6.gif";
link6_on = new Image;
link6_on.src = "img/link6on.gif";
link7_off = new Image;
link7_off.src = "img/link7.gif";
link7_on = new Image;
link7_on.src = "img/link7on.gif";
link8_off = new Image;
link8_off.src = "img/link8.gif";
link8_on = new Image;
link8_on.src = "img/link8on.gif";
link9_off = new Image;
link9_off.src = "img/link9.gif";
link9_on = new Image;
link9_on.src = "img/link9on.gif";
link10_off = new Image;
link10_off.src = "img/link10.gif";
link10_on = new Image;
link10_on.src = "img/link10on.gif";
link11_off = new Image;
link11_off.src = "img/link11.gif";
link11_on = new Image;
link11_on.src = "img/link11on.gif";
link12_off = new Image;
link12_off.src = "img/link12.gif";
link12_on = new Image;
link12_on.src = "img/link12on.gif";
link13_off = new Image;
link13_off.src = "img/link13.gif";
link13_on = new Image;
link13_on.src = "img/link13on.gif";
link14_off = new Image;
link14_off.src = "img/link14.gif";
link14_on = new Image;
link14_on.src = "img/link14on.gif";


//------------------------------------
function swap(img1, img2)
	{
	     document.images[img1].src=eval(img2+".src");
	     /*if (img1 == "link14")
	        {
	          document.images[img1].src=eval(img2+".src");
	          
		    }*/
	}
	
//------------------------------------
function submitArticleForm()
	{
	if (frmArticle.txtTitle.value=='')
		alert ("! الرجاء كتابة عنوان الخبر");
	else if (frmArticle.txtSummary.value=='')
		alert ("! الرجاء كتابة ملخص الخبر");
	else if (frmArticle.txtDetails.value=='')
		alert ("! الرجاء كتابة تفصيل الخبر");
	else
		return true;
	return false;
	}


//------------------------------------
function submitVoteForm()
	{
                if (frmVote.question.value=='')
		alert ("! الرجاء كتابة السؤال");
	else if (frmVote.response1.value=='')
		alert ("! الرجاء كتابة الإجابة الأولى");
	else if (frmVote.response2.value=='')
		alert ("! الرجاء كتابة الإجابة الثانية");
	else
		return true;
	return false;
	}
//------------------------------------
function submitunionForm()
	{
	if (frmunion.txtunion.value=='')
		alert ("! الرجاء كتابة اسم الإتحاد");
	else if ((frmunion.txtunion.value =='') && (frmcategory.unionName.value==0))
	        alert ("! الرجاء أختيار اسم الإتحاد");
	else
		return true;
	return false;
	}

//------------------------------------
function submitEventForm()
	{
	if (frmEvent.year.value== 0 )
		alert ("! الرجاء أختيار السنه");
	else if (frmEvent.Category.value== 0)
		alert ("! الرجاء اختيار الإتحاد");
                else if (frmEvent.txtEvent.value== " ")
		alert ("! الرجاء كتابة الحدث");
	else
		return true;
	return false;
	}
//------------------------------------
function submitNewsForm()	
	{
	if (frmNews.txtMain.value=="")
		alert ("!الرجاء إدخال عدد الأخبار الرئيسية");
	else if (frmNews.txtOther.value=="")
		alert ("!الرجاء إدخال عدد الأخبار الفرعية");
	else
		return true; 
	return false;
	}

//------------------------------------
function submitPassForm()	
	{
	if (frmPass.txtPassOld.value=="")
		alert ("!الرجاء كتابة كلمة السر الحالية");
	else if (frmPass.txtPass1.value=="")
		alert ("!الرجاء كتابة كلمة السر الجديدة");
	else if (frmPass.txtPass2.value=="")
		alert ("!أعد كتابة كلمة السر الجديدة");
	else if (frmPass.txtPass1.value!=frmPass.txtPass2.value)
		alert ("!لا يوجد تطابق بين كلمتي السر");	
	else if (frmPass.txtPass1.value.length < 6)
		alert ("!كلمة السر يجب أن لا تقل عن 6 رموز")
	else
		return true; 
	return false;
	}


//------------------------------------
function OpenWin(url, h, w, scrl)
	{
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars=' + scrl + ',resizable=1'
	win = window.open(url, 'mywindow', winprops)
	}
	
//------------------------------------
function setImage(img,id)
	{
	if (id == "1" )
	    {
	      parent.opener.frmArticle.txtImage.value = img;	
	      parent.close();
	    }
	else if (id == "2"  )
	    {
	      parent.opener.frmArticle.txtImage0.value = img;	
	      parent.close();
	    }
               else if (id == "3"  )
	    {
	      parent.opener.frmVote.txtImage1.value = img;	
	      parent.close();
	    }
               else if (id == "4"  )
	    {
	      parent.opener.frmVote.txtImage2.value = img;	
	      parent.close();
	    }
	}

//------------------------------------
function submitUploadForm()
	{
	fileName = frmUpload.txtFile.value;
	fileType = fileName.substr(fileName.length-3,3).toLowerCase();
	
	if (fileName=='')
		alert ("! الرجاء اختيار الملف المراد تحميله");
	else if (fileType != "gif" && fileType != "jpg") 
		alert("! GIF - JPG :هيئات الصور المسموح بتحميلها فقط هي");
	else
		return true;
	return false;		
	}


//------------------------------------
function submitUploadPDF()
	{
	fileName = frmUpload.txtFileName.value;
	fileType = fileName.substr(fileName.length-3,3).toLowerCase();
	update = frmUpload.txtUpdate.value;
	
	if (frmUpload.txtLinkName.value=='')
		alert ("! الرجاء ذكر اسم الرابط");
	else if (fileName=='' && update==0)
		alert ("! الرجاء اختيار الملف المراد تحميله");
	else if (frmUpload.txtCatName.value==0)
		alert ("! الرجاء اختيار التصنيف المناسب");
	else if (fileType != "pdf" && fileName!='') 
		alert("! pdf يمكنك فقط تحميل الملفات بهيئة ");
	else
		return true;
	return false;		
	}

//------------------------------------
function OpenWin(url, h, w, scrl)
	{
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars=' + scrl + ',resizable=0'
	win = window.open(url, 'mywindow', winprops)
	}

//-----------------------------------
function editPDF(pdfName, pdfCat, pdfID, pdfFile)
	{
		frmUpload.txtLinkName.value=pdfName;
		frmUpload.txtCatName.selectedIndex = pdfCat;
		frmUpload.txtID.value=pdfID;
		frmUpload.btnUploadPDF.value="تعديل ملف"
		frmUpload.txtUpdate.value = 1;
		frmUpload.txtCurrentFile.value = pdfFile;
		lblTitle.innerText = "تعديل ملف";
		lblComment.innerHTML = "<font color=DF0024>ملاحظة:</font> يرجى ترك حقل الملف خالياً إلا إذا رغبت في تحميل ملف بديل."
}

//-----------------------------------------
function delPDF(pdfID)
	{
		response = confirm(" هل تريد فعلاً حذف هذا الملف ؟");
		if (response) window.location='pdfAction.php?id=' + pdfID + '&action=del';
	}
	
//-----------------------------------------
function delpicture(pictureId)
	{
		response = confirm(" هل تريد فعلاً حذف هذه الصورة؟");
		if (response) window.location='upload-picture.php?ID=' + pictureId+ '&action=del';
	}

//-----------------------------------------
function delArticle(articleID)
	{
		response = confirm(" هل تريد فعلاً حذف هذا الخبر ؟");
		if (response) window.location='editArticle.php?newsID=' + articleID + '&action=del';
	}

//-----------------------------------------
function delVote(voteID)
	{
		response = confirm(" هل تريد فعلاً حذف هذا الإستطلاع؟");
		if (response) window.location='editVote.php?voteID=' + voteID+ '&action=del';
	}

//-----------------------------------------
function delevent(eventID)
	{
		response = confirm(" هل تريد فعلاً حذف هذا الحدث؟");
		if (response) window.location='addevent.php?eventID=' + eventID + '&action=del';
	}

//-----------------------------------------
function submitSearchForm()
	{
	   if (frmSearch.txtKeyWord.value == "")
		   alert ("الرجاء ادخال كلمة البحث");
	   else
		  return true;
	   return false;
	   
	}

//-----------------------------------------
function getunion()
	{
	 //salert(address);
	// window.location = 'union.php?address=' + address + '&union=' + union;
	 document.frmunion.txtunion.value = document.frmunion.unionName.options[document.frmunion.unionName.selectedIndex].text;
	 //document.frmunion.txtid.value = document.frmunion.unionName.options[document.frmunion.unionName.selectedIndex].index;
	 //document.frmunion.txtaddres.value = address;
	}
	
	
//-----------------------------------------
function jumpPage(newPage)
 {
  if ((newPage != "") && (newPage ==0))
  {
    //window.location = "index.php"
  }
  else if (newPage != "") 
  {
   window.location = newPage
  } 
 }
