function echeck(myForm) 
{
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(myForm))
	{
		return (true)
	}
}

function CheckMail() 
{
var problem = 'No';
if(document.maillistform.email.value == "" || !echeck(document.maillistform.email.value))         
{
         alert ("الرجاء كتابة البريد الإلكتروني بشكل صحيح!\r\n");
         document.maillistform.email.focus();
         document.maillistform.email.style.backgroundColor = "#FFCC33";
         problem = 'Yes';
         return false;
}
if(problem=='No') 
{
    return true;
} 
else 
{
    return false;
}
}

/* ----------------------- Add Artical Form ------------------------- */

function CheckArticlesForm() 
{
var problem = 'No';
if(document.addarticleform.name.value == "")
{
         alert ("الرجاء كتابة الأسم\r\n");
         document.addarticleform.name.focus();
         document.addarticleform.name.style.backgroundColor = "#FFCC33";
         problem = 'Yes';
         return false;
}

if(document.addarticleform.email.value == "" || !echeck(document.addarticleform.email.value))
{
         alert ("الرجاء كتابة الإيميل بشكل صحيح\r\n");
         document.addarticleform.email.focus();
         document.addarticleform.email.style.backgroundColor = "#FFCC33";
         problem = 'Yes';
         return false;
}

if(document.addarticleform.title.value == "")         
{
         alert ("الرجاء كتابة عنوان المقال\r\n");
         document.addarticleform.title.focus();
         document.addarticleform.title.style.backgroundColor = "#FFCC33";
         problem = 'Yes';
         return false;
}
if(document.addarticleform.article.value == "")         
{
         alert ("كتابة كتابة محتوى المقال\r\n");
         document.addarticleform.article.focus();
         document.addarticleform.article.style.backgroundColor = "#FFCC33";
         problem = 'Yes';
         return false;
}

if(problem=='No') 
{
    return true;
} 
else 
{
    return false;
}
}

function CheckNewsForm() 
{
var problem = 'No';
if(document.addarticleform.name.value == "")
{
         alert ("الرجاء كتابة الأسم\r\n");
         document.addarticleform.name.focus();
         document.addarticleform.name.style.backgroundColor = "#FFCC33";
         problem = 'Yes';
         return false;
}

if(document.addarticleform.email.value == "" || !echeck(document.addarticleform.email.value))
{
         alert ("الرجاء كتابة الإيميل بشكل صحيح\r\n");
         document.addarticleform.email.focus();
         document.addarticleform.email.style.backgroundColor = "#FFCC33";
         problem = 'Yes';
         return false;
}

if(document.addarticleform.title.value == "")         
{
         alert ("الرجاء كتابة عنوان المقال\r\n");
         document.addarticleform.title.focus();
         document.addarticleform.title.style.backgroundColor = "#FFCC33";
         problem = 'Yes';
         return false;
}
if(document.addarticleform.news.value == "")         
{
         alert ("كتابة كتابة محتوى الخبر\r\n");
         document.addarticleform.news.focus();
         document.addarticleform.news.style.backgroundColor = "#FFCC33";
         problem = 'Yes';
         return false;
}

if(problem=='No') 
{
    return true;
} 
else 
{
    return false;
}
}

/* ----------------------- Add Artical Form ------------------------- */

function CheckData() {
var problem = 'No';
if (document.loginform.username.value.length <= 0) {
alert ("أسم المستخدم");
document.loginform.username.value = "";
document.loginform.username.focus();
problem = 'Yes';
return false;
}
if (document.loginform.password.value.length <= 0) {
alert ("كلمة السر");
document.loginform.password.value = "";
document.loginform.password.focus();
problem = 'Yes';
return false;
}
if(problem=='No') {
return true;
} else {
return false;
}
}

/* ----------------------- CheckCommentBox ------------------------- */

function CheckCommentBox() 
{
var problem = 'No';
if(document.checkcommentbox.name.value == "")
{
         alert ("الرجاء كتابة الأسم\r\n");
         document.checkcommentbox.name.value = "";
         document.checkcommentbox.name.focus();
         document.checkcommentbox.name.style.backgroundColor = "#FFCC33";
         problem = 'Yes';
         return false;
}
/*
if(!echeck(document.checkcommentbox.email.value))         
{
         alert ("الرجاء كتابة الإيميل بشكل صحيح\r\n");
         document.checkcommentbox.email.focus();
         document.checkcommentbox.email.style.backgroundColor = "#FFCC33";
         problem = 'Yes';
         return false;
}
if(document.checkcommentbox.subject.value == "")         
{
         alert ("الرجاء كتابة عنوان التعليق\r\n");
         document.checkcommentbox.subject.value = "";
         document.checkcommentbox.subject.focus();
         document.checkcommentbox.subject.style.backgroundColor = "#FFCC33";
         problem = 'Yes';
         return false;
}
*/
if(document.checkcommentbox.comment.value == "")         
{
         alert ("الرجاء كتابة التعليق\r\n");
         document.checkcommentbox.comment.value = "";
         document.checkcommentbox.comment.focus();
         document.checkcommentbox.comment.style.backgroundColor = "#FFCC33";
         problem = 'Yes';
         return false;
}
if(document.checkcommentbox.captchacode.value == "")         
{
         alert ("لإضافة التعليق ، الرجاء كتابة كود التحقق\r\n");
         document.checkcommentbox.captchacode.value = "";
         document.checkcommentbox.captchacode.focus();
         document.checkcommentbox.captchacode.style.backgroundColor = "#FFCC33";
         problem = 'Yes';
         return false;
}

if(problem=='No') 
{
    return true;
} 
else 
{
    return false;
}
}

/* ----------------------- CheckCommentBox ------------------------- */

/* ----------------------- Main News Box ------------------------- */
/* Main Box News */
    current_image = 1;
    function show_news_block(id)
    {
	for(i = 1; i < 15; i++)
	{
		if(i != id)
		{
			obj = fetch_object("main-head-news" + i);
			obj.className = "unshow_main-head-news";
			obj = fetch_object("main-head-news-photo" + i);
			obj.className = "unshow_main-head-news-photo";
			obj = fetch_object("left_main-head-news" + i);
			obj.className = "unshow_left_main-head-news";
		}
		else
		{
			obj = fetch_object("main-head-news" + i);
			obj.className = "show_main-head-news";
			obj = fetch_object("main-head-news-photo" + i);
			obj.className = "show_main-head-news-photo";
			obj = fetch_object("left_main-head-news" + i);
			obj.className = "show_left_main-head-news";
		}
	}
	current_image = id;
    }
/* Main Box News */

/* 
    function auto_change()
    {
         if(current_image + 1 > 14)
         {
              show_news_block(1);
         }
         else
         {
              show_news_block(current_image + 1);
         }
         setTimeout("auto_change()", 5000);
    }
 */

/* Move Options */
    function show_main_news_box(id)
    {
	for(ii = 1; ii < 3; ii++)
	{
		if(ii != id)
		{
			obj = fetch_object("main_news_box" + ii);
			obj.className = "unmain_box_background";
			obj = fetch_object("main_news_box-option" + ii);
			obj.className = "unshow_main-news-box-option";
		}
		else
		{

			obj = fetch_object("main_news_box" + ii);
			obj.className = "main_box_background";
			obj = fetch_object("main_news_box-option" + ii);
			obj.className = "show_main-news-box-option";
		}
	}
    }
/* Move Options */

    function fetch_object(idname)
    {
	   if (document.getElementById)
	   {
            return document.getElementById(idname);
	   }
	   else if (document.all)
	   {
            return document.all[idname];
	   }
	   else if (document.layers)
        {
            return document.layers[idname];
        }
	   else
	   {
		return null;
	   }
    } 
/* ----------------------- Main News Box ------------------------- */

if(document.location.protocol=='http:'){
 var Tynt=Tynt||[];Tynt.push('dB4lGoNWyr35t9adbi-bnq');Tynt.i={"st":true,"ap":"اقرأ المزيد: "};
 (function(){var s=document.createElement('script');s.async="async";s.type="text/javascript";s.src='http://tcr.tynt.com/ti.js';var h=document.getElementsByTagName('script')[0];h.parentNode.insertBefore(s,h);})();
}
