﻿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 mail_field = document.getElementById("email");
	if (mail == "") {
		if (lang == 'sr'){
			alert_phplist("Molimo vas da unesete vašu e-mail adresu.");
		}
		else if (lang == 'en'){
			alert_phplist("Please enter your email address.");
		}
		//$("div#response").show();
		//$("div#response").empty();
		//$("div#response").append("Please enter your email address.");
		return false;
    }  
	else
	{
		if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(mail)){
		}
		else{
			if (lang == 'sr'){
				alert_phplist("E-mail adresa koju ste uneli je neispravna.")
			}
			else if (lang == 'en'){
				alert_phplist("Email address you entered is not valid.")
			}
			//$("div#response").show();
			//$("div#response").empty();
			//$("div#response").append("Email address you entered is not valid.");
			return false;
		}
	}	
	if (mail != "" && (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(mail)))
		return true;
 }
 
  
function check_unsubscribe_form() {
  var mail = document.getElementById("unsubscribeemail").value;
  var mail_field = document.getElementById("unsubscribeemail");
	if (mail == "") {
		if (lang == 'sr'){
			alert_phplist("Molimo vas da unesete vašu e-mail adresu.");
		}
		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 == 'sr'){
				alert_phplist("E-mail adresa koju ste uneli je neispravna");
			}
			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;
 }