﻿function doClear(theText) {
     if (theText.value == theText.defaultValue) {
         theText.value = ""
     }
 }
function checkform() { 
  var lang = document.getElementById("language").value;	
  var mail = document.getElementById("email").value;
  var name = document.getElementById("attribute1").value;

	if (mail == "") {
		if (lang == 'ar'){
			alert_phplist("الرجاء إدخال بريدك الإلكتروني.");
		}
		else if (lang == 'en'){
			alert_phplist("Please enter your email address.");
		}		
		return false;
    }  
	else
	{
		if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(mail)){
		}
		else{
			if (lang == 'ar'){
				alert_phplist("عنوان البريد الإلكتروني الذي أدخلته غير صحيح.")
			}
			else if (lang == 'en'){
				alert_phplist("Email address you entered is not valid.")
			}
			return false;
		}
		
		if (name == ''){
			if (lang == 'ar'){
				alert_phplist("الرجاء إدخال اسمك.");
			}
			else if (lang == 'en'){
				alert_phplist("Please enter your name.");
			}		
			return false;
		}
			
	}	
	if (mail != "" && (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(mail)) && name != '')
		return true;
 }
 
  
function check_unsubscribe_form() {
  var mail = document.getElementById("unsubscribeemail").value;
  	if (mail == "") {
		if (lang == 'ar'){
			alert_phplist("الرجاء إدخال بريدك الإلكتروني.");
		}
		else if (lang == 'en'){
			alert_phplist("Please enter your email address.");
		}
        return false;
    }  
	else
	{
		if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(mail)){
		}
		else {
			if (lang == 'ar'){
				alert_phplist("عنوان البريد الإلكتروني الذي أدخلته غير صحيح.");
			}
			else if (lang == 'en'){
				alert_phplist("Email address you entered is not valid.")
			}
			return false;
		}
	}
	if (mail != "" && (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(mail)))
		return true;
 }