function check_login(txtuser,txtpwd)
{ 
var boolResult=CheckInput(txtuser,"الرجاء كتابة اسم المستخدم")&& CheckInput(txtpwd,"الرجاء كتابة كلمة السر");
return boolResult;
}
/***********************************************************/
function checkMedia(txtTitle,txtSubject)
{ 
var boolResult=CheckInput(txtTitle,"الرجاء ادخال  العنوان")&& CheckInput(txtSubject,"الرجاء ادخال نص العنوان");
return boolResult;
} 
/**********************************************************/
function checkLink(txtTitle,txtUrl)
{ 
var boolResult=CheckInput(txtTitle,"الرجاء ادخال  العنوان")&& CheckInput(txtSubject,"الرجاء ادخال نص العنوان");
return boolResult;
} 
/**********************************************************/
function check_EditUser(txtuser,txtpwd,txtcon)
{ 
var boolResult=CheckInput(txtuser,"الرجاء كتابة اسم المستخدم")&& CheckInput(txtpwd,"الرجاء كتابة كلمة السر")&& CheckInput(txtcon,"الرجاء كتابة تأكيد كلمة السر ")&& CheckConfirm(txtpwd,txtcon);
return boolResult;
}
/**********************************************************/
function checkthread(txtName,txtEmail,txtSubject)
{ var boolResult=CheckInput(txtName,"الرجاء ادخال  الإسم")&& CheckInput(txtEmail,"الرجاء ادخال  الإيميل") && CheckInput(txtSubject,"الرجاء ادخال  المطلوب");
return boolResult;
} 
/**********************************************************/
function checkContact(txtName,txtEmail,txtTitle,txtSubject)
{ var boolResult=CheckInput(txtName,"الرجاء ادخال  الإسم")&& CheckInput(txtEmail,"الرجاء ادخال  الإيميل")&& CheckInput(txtTitle,"الرجاء ادخال  العنوان")&& CheckInput(txtSubject,"الرجاء ادخال  المطلوب");
return boolResult;
} 
/**********************************************************/
function checktell(txtName,txtEmail,txtFrn,txtFrnEmail)
{ var boolResult=CheckInput(txtName,"الرجاء ادخال  اسمك")&& CheckInput(txtEmail,"الرجاء ادخال  ايميلك")&& CheckInput(txtFrn,"الرجاء ادخال  اسم صديقك")&& CheckInput(txtFrnEmail,"الرجاء ادخال  ايميل صديقك");
return boolResult;
} 
/**********************************************************/
function check_Search(txtSerach)
{ 
var boolResult=CheckInput(txtSerach,"الرجاء ادخال كلمة البحث");
return boolResult;
}
function check_vote(txtVote)
{ 
var boolResult=CheckInput(txtVote,"الرجاء الاختيار");
return boolResult;
}
function check_newsLtr(txtNews)
{
var boolResult=CheckInput(txtNews,"الرجاء كتابة الايميل");
return boolResult;
}
/**********************************************************/
function check_New(ddl)
{ 
var boolResult=CheckDdl(ddl,"Please Select type .");
return boolResult;
}
/**********************************************************/
function CheckDdl(strCtrlId,strMsgTxt)
{
     if(txttrim(document.getElementById(strCtrlId).value)== 0 )
     {   
    	alert(strMsgTxt);
        try{
	        document.getElementById(strCtrlId).focus();
	    }catch(er){};	    
	    return false;
	}	 
	return true;
}

/**************************************************************************/
function CheckInput(strCtrlId, strMsgTxt)
{
     if(txttrim(document.getElementById(strCtrlId).value)== "" )
     {   
    	alert(strMsgTxt);
        try{
	        document.getElementById(strCtrlId).focus();
	    }catch(er){};	    
	    return false;
	}	
	return true;
}
	
function txttrim(str){

        
        while(str.charAt(0) == (" ") )
        { 
            str = str.substring(1);
        }

        while(str.charAt(str.length-1) == " " )
        { 
             str = str.substring(0,str.length-1);
        }
        return str;
}
/**************************************************************************************************/	

function CheckConfirm(strTxtPwd,strTxtCon)
{
     if(document.getElementById(strTxtPwd).value != document.getElementById(strTxtCon).value)
     {   
    	alert('كلمة السر غير متطابقة الرجاء اعادة كتابنها بحذر');
        document.getElementById(strTxtPwd).focus();
	    return false;
	}	
	return true;
}
/**************************************************************************************************/	
function IsNumeric(strCtrlId, strMsgTxt){
   var txt = document.getElementById(strCtrlId).value;
   var ValidChars = "0123456789.";
   var Char;
   for (i = 0; i < txt.length ; i++) 
   { 
      Char = txt.charAt(i); 
      if (ValidChars.indexOf(Char) == -1)
      {
            if(strMsgTxt != null && strMsgTxt != "")
            {
                alert(strMsgTxt);
            }
            
         return false;
       } 
    }
   return true;  
   }
/**************************************************************************************************/
function IsChar(strCtrlId, strMsgTxt)
{
    var textchar = document.getElementById(strCtrlId).value;
    var Validch = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ";
    for (i=0;i<textchar.length;i++) 
    { 
          var chr = textchar.charAt(i);
          if (Validch.indexOf(chr) == -1)
          {       
          
                 if(strMsgTxt != null && strMsgTxt != "")
                 {
                    alert(strMsgTxt);
                 }
                 
                  try{
	                document.getElementById(strCtrlId).focus();
	              }catch(er){};
	              	    
             return false;
          }
    }
    return true;
}
/**************************************************************************************************/
function validate(email,strMsgTxt) {
   var reg ='/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/';  
   if(reg.test(email) == false) {
      alert(strMsgTxt);
      return false;
   }
    return true;
}
