function jsdel(url) {
    var answer = confirm("تحذير: لايمكن التراجع عن هذه الخطوة نهائيا وقد يتأكثر الموقع. هل ترغب في الحذف على مسئوليتك؟")
     if (answer){
         window.location = ""+ url +"";
     }
}

function validateEmail(emailAddress) {
   var match = /^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*$/.test(emailAddress);
   return match;
}

function ShowHide(varObjID){
   if(document.getElementById(varObjID).style.display=="none"){
      document.getElementById(varObjID).style.display="block";
      //funSImg(varObjID);
   }else{
      document.getElementById(varObjID).style.display="none";
   }
}

function ShowHidePrint(varObjID){
   if(document.getElementById(varObjID).style.display=="none"){
      document.getElementById('mainDV').style.display="none";
      document.getElementById(varObjID).style.display="block";
      //funSImg(varObjID);
   }else{
      document.getElementById(varObjID).style.display="none";
      document.getElementById('mainDV').style.display="block";
   }
}

function CheckContactForm(contactform){

        if (contactform.name.value == "" ) { alert( "الرجاء أدخل الإسم بالكامل" );
        contactform.name.focus();
        return false; }

        if (contactform.email.value == "" ) { alert( "أدخل البريد الإلكتروني" );
        contactform.email.focus();
        return false; }

        checkEmail = contactform.email.value
	if ((checkEmail.indexOf('@') < 0) || ((checkEmail.charAt(checkEmail.length-4) != '.') && (checkEmail.charAt(checkEmail.length-3) != '.')))
	{alert("البريد  الإلكتروني  خطأ!.");
	contactform.email.focus();
	return false; }


        if (contactform.subject.value == "" ) { alert( "من فضلك أكتب موضوع للرسالة" );
        contactform.subject.focus();
        return false; }

        if (contactform.msg.value == "" ) { alert( "أكتب الرسالة" );
        contactform.msg.focus();
        return false; }


   // return true;
}


function CheckTellform(tellform){

        if (tellform.name.value == "" ) { alert( "الرجاء أدخل الإسم بالكامل" );
        tellform.name.focus();
        return false; }

        if (tellform.email.value == "" ) { alert( "أدخل البريد الإلكتروني" );
        tellform.email.focus();
        return false; }

        checkEmail = tellform.email.value
	if ((checkEmail.indexOf('@') < 0) || ((checkEmail.charAt(checkEmail.length-4) != '.') && (checkEmail.charAt(checkEmail.length-3) != '.')))
	{alert("البريد  الإلكتروني  خطأ!.");
	tellform.email.focus();
	return false; }


        if (tellform.fname.value == "" ) { alert( "أدخل إسم صديقك" );
        tellform.fname.focus();
        return false; }



         if (tellform.femail.value == "" ) { alert( "أدخل البريد الالكتروني الخاص بصديقك" );
        tellform.femail.focus();
        return false; }

        checkEmail = tellform.femail.value
	if ((checkEmail.indexOf('@') < 0) || ((checkEmail.charAt(checkEmail.length-4) != '.') && (checkEmail.charAt(checkEmail.length-3) != '.')))
	{alert("البريد  الإلكتروني  خطأ!.");
	tellform.femail.focus();
	return false; }

   // return true;
}


function CheckCommform(commform){

        if (commform.name.value == "" ) { alert( "الرجاء أدخل الإسم بالكامل" );
        commform.name.focus();
        return false; }

        if (commform.email.value == "" ) { alert( "أدخل البريد الإلكتروني" );
        commform.email.focus();
        return false; }


        if (commform.country.value == "" ) { alert( "الرجاء أدخل الدولة" );
        commform.country.focus();
        return false; }
        
        if (commform.subject.value == "" ) { alert( "الرجاء أدخل الموضوع" );
        commform.subject.focus();
        return false; }
        
        if (commform.comment.value == "" ) { alert( "الرجاء أدخل نص التعليق" );
        commform.comment.focus();
        return false; }


   // return true;
}

   var newwindow;
     function popimg(url)
    {
        newwindow=window.open(url,'name','height=500,width=650,left=100,top=100,resizable=yes,scrollbars=yes,toolbar=yes,status=yes');
	if (window.focus) {newwindow.focus()}
    }


    function textCounter() {

    var field = document.newsf.hometext;
    var counter = document.getElementById('remChar');
    var maxlimit = 140;

      if(field.value.length > maxlimit)
        field.value = field.value.substring(0, maxlimit);

      else
        counter.innerHTML = maxlimit - field.value.length;
     }
