function getlink(link,divtag){
sendRequest(link,divtag);
return false
}

function open_page(new_url)
{
LeftPosition = (screen.width) ? (screen.width-300)/2 : 0;
TopPosition = (screen.height) ? (screen.height-30)/2 : 0;
settings="status=0,toolbar=0,width=300,height= 130 , top="+TopPosition+", left="+LeftPosition+", scrollbars=yes resizeable=no";
window.open (new_url,"search_result",settings);
}
//---------------------------------------
function open_new_page(new_url)
{
LeftPosition = (screen.width) ? (screen.width-700)/2 : 0;
TopPosition = (screen.height) ? (screen.height-430)/2 : 0;
settings="status=0,toolbar=0,width=700,height= 430 , top="+TopPosition+", left="+LeftPosition+", scrollbars=yes resizeable=no";
window.open (new_url,"user_details",settings);
}

/**
 *
 * @access public
 * @return void
 **/
function open_small_page(new_url){
LeftPosition = (screen.width) ? (screen.width-400)/2 : 0;
TopPosition = (screen.height) ? (screen.height-250)/2 : 0;
settings="status=0,toolbar=0,width=400,height= 250 , top="+TopPosition+", left="+LeftPosition+", scrollbars=yes resizeable=no";
window.open (new_url,"view",settings);
}

//-----------------------------------------------------------
function is_valid_contact() {
if (contactform.company.value=="" ||contactform.custmer.value==""
   ||contactform.email.value==""||contactform.bill.value==""
   ||contactform.place.value==""||contactform.program.value==""
   ||contactform.message.value==""  )
 {
 alert(" أكمل البيانات المطلوبة ");
 return false;
}
else
 {
    var x = contactform.email.value;
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(x)==false)
	  {
	   alert('بريد الراسل غير صحيح');
	  }
    else
      {
        contactform.submit();
	    return true;
      }
  }
}
//*********************************************
function is_valid_register_user(){
 if(document.register_form.password.value!=""  && document.register_form.password_conf.value!=""  && document.register_form.email.value!="" )
  {
   if(document.register_form.password.value==document.register_form.password_conf.value)
    {
	 if( document.register_form.email.value.indexOf(".") > 2 && document.register_form.email.value.indexOf("@") > 0 )
	  {

	       document.register_form.submit();return false;
	  }
	 else
	  {
	  alert("هناك خطأ فى البريد الإلكترونى");document.register_form.email.focus();return false;
	  }
	}
   else
	{
     alert("كلمة المرور لا تتوافق");document.register_form.password_conf.focus();return false;
	}
  }
 else
  {
     alert("أدخل البيانات كاملة");return false;
  }
}
//*********************************************
function is_valid_register(){
 if(document.register_form.password.value!=""  && document.register_form.password_conf.value!=""  && document.register_form.email.value!="" )
  {
   if(document.register_form.password.value==document.register_form.password_conf.value)
    {
	 if( document.register_form.email.value.indexOf(".") > 2 && document.register_form.email.value.indexOf("@") > 0 )
	  {

	       document.register_form.submit();return true;
	  }
	 else
	  {
	  alert("هناك خطأ فى البريد الإلكترونى");document.register_form.email.focus();return false;
	  }
	}
   else
	{
     alert("كلمة المرور لا تتوافق");document.register_form.password_conf.focus();return false;
	}
  }
 else
  {
     alert("أدخل البيانات كاملة");return false;
  }
}
//*************************************************
function is_valid_login(){
 if(document.login_form.email.value !="" && document.login_form.password.value !="" )
  {
     if( document.login_form.email.value.indexOf(".") > 2 && document.login_form.email.value.indexOf("@") > 0 )
	  {
	   document.login_form.submit();
	   return false;
	  }
	else
	  {
	  alert("هناك خطأ فى البريد الإلكترونى");document.login_form.email.focus();return false;
	  }
  }
 else
 {
  alert("أكمل البيانات المطلوبة");return false;
 }
}
//*************************************************
function is_valid_login_admin(){
 if(document.login_form.user_name.value !="" && document.login_form.password.value !="" )
  {
   document.login_form.submit();
   return false;
  }
 else
 {
  alert("أكمل البيانات المطلوبة");return false;
 }
}
//----------------------------------------------------------
function confirm_logout(){
	if(window.confirm("هل أنت متأكد "))
      {
       top.location.href="logout.php";
	  }
}
//----------------------------------------------------
/**
 *
 * @access public
 * @return void
 **/
function get_day(){

<!-- This script and many more are available online from -->

<!-- The JavaScript Source!! http://javascriptsource.com -->



<!-- Begin

var day="";

var month="";

var myweekday="";

var year="";

mydate = new Date();

myday = mydate.getDay();

mymonth = mydate.getMonth();

myweekday= mydate.getDate();

weekday= myweekday;

myyear= mydate.getYear();

year = myyear

if(myday == 0)

day = " الأحد, "

else if(myday == 1)

day = " الأثنين, "

else if(myday == 2)

day = " الثلاثاء, "

else if(myday == 3)

day = " الاربعاء, "

else if(myday == 4)

day = " الخميس, "

else if(myday == 5)

day = " الجمعة, "

else if(myday == 6)

day = " السبت, "

if(mymonth == 0) {

month = "يناير "}

else if(mymonth ==1)

month = "فبراير "

else if(mymonth ==2)

month = "مارس "

else if(mymonth ==3)

month = "ابريل "

else if(mymonth ==4)

month = "مايو "

else if(mymonth ==5)

month = "يونيو "

else if(mymonth ==6)

month = "يوليو "

else if(mymonth ==7)

month = "اغسطس "

else if(mymonth ==8)

month = "سبتمبر "

else if(mymonth ==9)

month = "اكتوبر "

else if(mymonth ==10)

month = "نوفمبر "

else if(mymonth ==11)

month = "ديسمبر "
// End -->
document.write("<b><font face=Tahoma size=1>" + day +myweekday   );
document.write(month + ", " + year + "</font></b>");
}
//-----------------------------------------------------------------
/**
 *
 * @access public
 * @return void
 **/
//-----------------------------------------------------
//-----------------------------------------------------------
	function expand(listID) {
		listID.style.display=(listID.style.display=="none" || listID.style.display=="")?"":"none";
		window.event.cancelBubble=true;
	}
//----------------------------------------------------------
	function contract(listID) {
		listID.style.display=(listID.style.display=="show")?"":"none";
		window.event.cancelBubble=true;
	}
//----------------------------------------------------------
	function show_hide(x)
	{
	obj = document.getElementById(x);
		if(	obj.style.display == "block")
		{
			obj.style.display = "none";
		}
		else
		{
			obj.style.display = "block";
		}
	}

//----------------------------------------------------------
/**
 *
 * @access public
 * @return void
 **/
function edit_cat_e3lanat(){
  cat_id=edit_e3lan.cat_id.options[edit_e3lan.cat_id.selectedIndex].value;
  if(cat_id)
    window.location.href='left_side.php?view=e3lanat&e3lanat_action=edit_e3lan&step=1&cat_id='+cat_id;
}
//--------------------------------------------------------------
//--------------------------------------------------------------
function is_valid_user(){
 if(document.adduser_form.user_name.value!=""
   && document.adduser_form.password.value!="" && document.adduser_form.password_conf.value!=""
   && document.adduser_form.email.value!="" && document.adduser_form.mobile.value!="")
  {
   if(document.adduser_form.password.value==document.adduser_form.password_conf.value)
    {
	 if( document.adduser_form.email.value.indexOf(".") > 2 && document.adduser_form.email.value.indexOf("@") > 0 )
	  {
        document.adduser_form.submit();return true;
	  }
	 else
	  {
	  alert("هناك خطأ فى البريد الإلكترونى");return false;
	  }
	}
   else
	{
     alert("كلمة المرور لا تتوافق");return false;
	}
  }
 else
  {
     alert("أدخل البيانات كاملة");return false;
  }
}
//--------------------------------------------------------------
function confirm_delete_user(user_id){
if(confirm("سوف يتم حذف السجل , هل أنت متأكد ؟ "))
 {
 location.href="left_side.php?view=users&users_action=do_delete&user_id="+user_id;
 }
}
//*******************************************************
function is_valid_site_new(){
 if(document.site_new_form.site_new.value !="" )
  {
   document.site_new_form.submit();
   return true;
  }
 else
 {
  alert("أكمل البيانات المطلوبة");return false;
 }
}
//------------------------------------------------------------
function is_valid_send() {
if (sendform.sender_name.value=="" ||sendform.sender_email.value=="" ||sendform.frind_email.value=="" ||sendform.message.value=="") {
 alert(" أكمل البيانات المطلوبة ");
 return false;
}
else
 {
    $valid_email=true;

    var x = sendform.sender_email.value;
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(x)==false)
	  {
	   alert('بريد الراسل غير صحيح');
	   $valid_email=false;
	  }

	var x = sendform.frind_email.value;
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(x)==false)
	  {
	   alert('بريد المرسل إليه غير صحيح');
	    $valid_email=false;
	  }

  if($valid_email==true)
    {
	 sendform.submit();
	 return true;
	}
 }
}
//-----------------------------------------------------------
function is_valid_email() {
if (mail_form.email.value==""){
 alert(" أكمل البيانات المطلوبة ");
 return false;
}
else
 {
    var x = mail_form.email.value;
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(x)==false)
	  {
	   alert('بريد الراسل غير صحيح');
	  }
    else
      {
        mail_form.submit();
	    return true;
      }
  }
}
//--------------------------------------------------------------
function confirm_delete_email(id){
if(confirm("سوف يتم حذف السجل , هل أنت متأكد ؟ "))
 {
 location.href="left_side.php?view=maillist&maillist_action=edit_emails&step=2&delete=yes&email_id="+id;
 }
}
//---------------------------------------------------------------
function create_email_fields()
{
 index=document.emails_form.number_emails.options.selectedIndex;
 number_emails=document.emails_form.number_emails.options[index].value;
 window.location.href='left_side.php?view=maillist&maillist_action=add_emails&step=1&number_emails='+number_emails;
 document.emails_form.number_emails.options[index].selected;
}
//---------------------------------------------------------------

//---------------------------------------------------------------
/**
 *
 * @access public
 * @return void
 **/
function is_valid_email_edit(){
if (edit_email_form.email.value==""){
 alert(" أكمل البيانات المطلوبة ");
 return false;
}
else
 {
    var x = edit_email_form.email.value;
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(x)==false)
	  {
	   alert('البريد غير صحيح');
	  }
    else
      {
        edit_email_form.submit();
	    return true;
      }
  }
}
//----------------------------------------------------
function is_valid_emails_import(){
if(document.emails_import_form.file.value !="" )
  {
   	 document.emails_import_form.submit();
     return true;
  }
 else
 {
  alert("أكمل البيانات المطلوبة");
  return false;
 }
}
//--------------------------------------------------
/**
 *
 * @access public
 * @return void
 **/
function is_valid_sendmaillist(){
if(document.sendmaillist_form.subject.value !="" && document.sendmaillist_form.body.value !="")
  {
   	 document.sendmaillist_form.submit();
     return true;
  }
 else
 {
  alert("أكمل البيانات المطلوبة");
  return false;
 }
}
//--------------------------------------------------
function is_valid_settings(){
if(document.settings_form.site_title.value !=""   && document.settings_form.contactus_to.value !=""  )
  {
   	 document.settings_form.submit();
     return true;
  }
 else
 {
  alert("أكمل البيانات المطلوبة");
  return false;
 }
}
//---------------------------------------------------------------
function is_valid_country(){
if(document.country_form.country_name.value !="" )
  {
   	 document.country_form.submit();
     return true;
  }
 else
 {
  alert("أكمل البيانات المطلوبة");
  return false;
 }
}
//---------------------------------------------------------------
function is_valid_program(){
if(document.product_form.name.value !="" )
  {
   	 document.product_form.submit();
     return true;
  }
 else
 {
  alert("أكمل البيانات المطلوبة");
  return false;
 }
}
//---------------------------------------------------------------
function is_valid_pro_update(){
if(document.pro_updates_form.name.value !="" )
  {
   	 document.pro_updates_form.submit();
     return true;
  }
 else
 {
  alert("أكمل البيانات المطلوبة");
  return false;
 }
}
//---------------------------------------------------------------
function is_valid_question(){
if(document.questions_form.question.value !="" )
  {
   	 document.questions_form.submit();
     return true;
  }
 else
 {
  alert("أكمل البيانات المطلوبة");
  return false;
 }
}
//---------------------------------------------------------------
function is_valid_new(){
if(document.news_form.title.value !="" )
  {
   	 document.news_form.submit();
     return true;
  }
 else
 {
  alert("أكمل البيانات المطلوبة");
  return false;
 }
}
//---------------------------------------------------------------
function is_valid_customer(){
if(document.customers_form.name.value !="" )
  {
   	 document.customers_form.submit();
     return true;
  }
 else
 {
  alert("أكمل البيانات المطلوبة");
  return false;
 }
}
//---------------------------------------------------------------
function is_valid_topic(){
if(document.topics_form.topic_title.value !="" )
  {
   	 document.topics_form.submit();
     return true;
  }
 else
 {
  alert("أكمل البيانات المطلوبة");
  return false;
 }
}

//-----------------------------------------------------------
function is_valid_get_pass_email() {
if (get_pass_form.email.value=="")
 {
 alert(" أدخل بريدك");
 get_pass_form.email.focus();
 return false;
}
else
 {
    var x = get_pass_form.email.value;
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(x)==false)
	  {
	    alert('بريدك غير صحيح ');
 	    get_pass_form.email.focus();
        return false;
	  }
    else
      {
	       get_pass_form.submit();
	       return false;

      }
  }
}

//-----------------------------------------------
function validate()
{      if (document.myForm2.company.value=="")

      {

      alert("من فضلك أدخل اسم الشركة");

      document.myForm2.company.focus();

      return false;

      }

      if (document.myForm2.custmer.value=="")

      {

      alert("من فضلك أدخل اسم العميل");

      document.myForm2.custmer.focus();

      return false;

      }


    str = document.myForm2.email.value;
    if (str.indexOf('@') == -1 || str.indexOf('.') == -1)
   {
    alert (' فضلا اكتب بريدك الالكتروني الصحيح (الايميل) ');
   document.myForm2.email.focus();
   return false;
   }
   if (document.myForm2.bill.value=="")

      {

      alert("من فضلك أدخل رقم الفاتوره");

      document.myForm2.bill.focus();

      return false;

      }if (document.myForm2.place.value=="")

      {

      alert("من فضلك ادخل مكان الشراء");

      document.myForm2.place.focus();

      return false;

      }if (document.myForm2.program.value=="")

      {

      alert("من فضلك أدخل اسم البرنامج");

      document.myForm2.program.focus();

      return false;

      }
   if (document.myForm2.message.value=="")

      {

      alert("لم تقوم بإدخال البيان");

      document.myForm2.message.focus();

      return false;

      }if (document.myForm2.solution.value=="")

      {

      alert("ام تقم بإدخال الحلول");

      document.myForm2.solution.focus();

      return false;

      }
    return true;
}
//----------------------------------------------
function Layers(X)
{

		if(document.all[X].style.display == 'none')
		{
			document.all[X].style.display = ''
		}else
		{
			document.all[X].style.display = 'none'
		 }
}

function Layers2(Y)
{

		if(document.all[Y].style.display == 'none')
		{
			document.all[Y].style.display = ''
		}else
		{
			document.all[Y].style.display = 'none'
		 }
}

function val(Parent,Child)
	{
	if(document.form[Parent].checked==true)
		{
		for (i=0 ; i < document.form[Child].length ; i++)
			document.form[Child][i].checked = true ;
		}
	if(document.form[Parent].checked==false)
		{
		for (i=0 ; i < document.form[Child].length ; i++)
			document.form[Child][i].checked = false ;
		}
	}
//-----------------------------------------------------------

//-----------------------------------------------------------
function confirm_delete_program(id){
if(confirm("سوف يتم حذف السجل , هل أنت متأكد ؟ "))
 {
 location.href="left_side.php?view=product&product_action=edit&step=4&id="+id;
 }
}
//-----------------------------------------------------------
function confirm_delete_pro_up(id){
if(confirm("سوف يتم حذف السجل , هل أنت متأكد ؟ "))
 {
 location.href="left_side.php?view=pro_updates&pro_updates_action=edit&step=4&id="+id;
 }
}

//-----------------------------------------------------------
function confirm_delete_question(id){
if(confirm("سوف يتم حذف السجل , هل أنت متأكد ؟ "))
 {
 location.href="left_side.php?view=questions&questions_action=edit&step=4&id="+id;
 }
}
//-----------------------------------------------------------
function confirm_delete_new(id){
if(confirm("سوف يتم حذف السجل , هل أنت متأكد ؟ "))
 {
 location.href="left_side.php?view=news&news_action=edit&step=4&id="+id;
 }
}
//-----------------------------------------------------------
function confirm_delete_country(id){
if(confirm("سوف يتم حذف السجل , هل أنت متأكد ؟ "))
 {
 location.href="left_side.php?view=countries&countries_action=edit&step=3&delete=ture&id="+id;
 }
}

//-----------------------------------------------------------
function confirm_delete_customer(id){
if(confirm("سوف يتم حذف السجل , هل أنت متأكد ؟ "))
 {
 location.href="left_side.php?view=customers&customers_action=edit&step=4&id="+id;
 }
}
//-----------------------------------------------------------
function confirm_delete_topic(id){
if(confirm("سوف يتم حذف السجل , هل أنت متأكد ؟ "))
 {
 location.href="left_side.php?view=topics&topics_action=edit&step=4&topic_id="+id;
 }
}
//-----------------------------------------------------------
function confirm_delete_comment(id){
if(confirm("سوف يتم حذف السجل , هل أنت متأكد ؟ "))
 {
 location.href="left_side.php?view=t_comments&t_comments_action=edit&step=4&comment_id="+id;
 }
}

//------------------------------------------------------
function confirm_delete_topic_root(id){
if(confirm("سوف يتم حذف السجل , هل أنت متأكد ؟ "))
 {
 location.href="forum,do_delete,"+id+".html";
 }
}
//-----------------------------------------------------------
function confirm_delete_ads(id){
if(confirm("سوف يتم حذف السجل , هل أنت متأكد ؟ "))
 {
 location.href="left_side.php?view=ads&ads_action=edit&delete=true&step=2&&ads_id="+id;
 }
}
//------------------------------------------------------
function is_valid_ads(){
if(document.ads_form.name.value !="" && document.ads_form.url.value !="" )
  {
   	 document.ads_form.submit();
     return true;
  }
 else
 {
  alert("أكمل البيانات المطلوبة");
  return false;
 }
}
//-----------------------------------------------------------
function confirm_delete_contacts(id){
if(confirm("سوف يتم حذف السجل , هل أنت متأكد ؟ "))
 {
 location.href="left_side.php?view=contacts&contacts_action=edit&step=2&id="+id;
 }
}

//-----------------------------------------------------------
function confirm_delete_attachement(id){
if(confirm("سوف يتم حذف المرفق"))
 {
 location.href="left_side.php?view=questions&questions_action=edit&step=5&id="+id;
 }
}
//-----------------------------------------------------------
function confirm_delete_upd(id){
if(confirm("سوف يتم حذف المرفق"))
 {
 location.href="left_side.php?view=questions&questions_action=edit&step=5&id="+id;
 }
}

//---------------------------------------------------------------
function is_valid_change(){
 if( document.change_account_form.old_password.value !="" && document.change_account_form.new_password.value !=""
 && document.change_account_form.conf_new_password.value !=""  )
  {
   if(document.change_account_form.new_password.value == document.change_account_form.conf_new_password.value)
    {
	 document.change_account_form.submit();
     return true;
    }
    else
	{
	 alert("كلمات المرور غير متوافقة");return false;
	}
  }
 else
 {
  alert("أكمل البيانات المطلوبة");return false;
 }
}
//----------------------------------------------------------
function is_vaild_comment(){
 if(document.commentform.auther.value!="")
  {
   document.commentform.submit();return true;
  }
 else
  {
   alert(" أكمل البيانات المطلوبة ");
   return false;
  }
}
function validate_form()
{
    valid = true;
    err_msg=" الرجاء ادخال ";
  if ( document.pp.t1.value == "" )
    {
        err_msg+="رقم القرص ،";
        valid = false;
    }


if ( document.pp.t2.value == "" )
    {
        err_msg+="رقم الجهاز ،";
	    valid = false;
    }

if ( document.pp.t3.value == "" )
    {
        err_msg+="رقم الفاتورة ،";
        valid = false;
    }


	if ( document.pp.t4.value == "" )
    {
        err_msg+="مكان الشراء،";
        valid = false;
    }

   if(valid == false)
      {
	   alert ( err_msg );
	   return valid;
	  }
   else
      {
       document.pp.submit();return true;
      }

}