// JavaScript Document - flashforward.gr
function checkWholeFormEn(theForm) {
    var why = "";

	why += checkSName(theForm.isbn.value,theForm.title.value,theForm.author.value,"Please enter a search parameter: ISBN, title or author. \n");	

    if (why != "") {
       alert(why);
       return false;
    }
return true;
}

function checkWholeFormBG(theForm) {
    var why = "";

	why += checkSName(theForm.isbn.value,theForm.title.value,theForm.author.value,"Intra intr-o cautare parametru: ISBN, titlul sau autorul.\n");	

    if (why != "") {
       alert(why);
       return false;
    }
return true;
}
function checkSName (strng1,strng2,strng3,error) {
if ((strng1 == "") && (strng2 == "") && (strng3 == "")){
   } else {error="";}

return error;

}

function checkUpdate(theForm)
	{
    		var why = "";
    

 		why += isValidEmail(theForm.email.value,"Intra intr-o valabila adresa e-mail.\n");
		why += checkName(theForm.paswd.value,"Intra intr-o parola de cel putin 5 personaje.\n",5);
		why += checkName(theForm.user_code.value,"Introduceţi caracterele pe care le vedeţi în imagine.\n",6);
		why += checkName(theForm.firstname.value,"Introduceţi prenumele dvs.\n",2);
		why += checkName(theForm.lastname.value,"Introduceţi numele dvs.\n",2);
		why += checkName(theForm.address.value,"Introduceţi adresa dumneavoastră.\n",4);
		why += checkName(theForm.zip.value,"Introduceţi codul poştal.\n",4);
		why += checkName(theForm.city.value,"Introduceţi numele dumneavoastră de oraş.\n",2);		
        why += checkName(theForm.phone.value,"Introduceţi numărul dvs. de telefon, împreună cu codul de ţară.\n",10);  
		if (why != "")
		{
       			alert(why);
       			return false;
    		}
		return true;
	}

	function checkWholeFormRegister(theForm)
	{
    		var why = "";
 		why += isValidEmail(theForm.email.value,"Intra intr-o valabila adresa e-mail.\n");
		why += checkName(theForm.paswd.value,"Intra intr-o parola de cel putin 5 personaje.\n",5);
		why += checkName(theForm.user_code.value,"Introduceţi caracterele pe care le vedeţi în imagine.\n",6);
		why += checkName(theForm.firstname.value,"Introduceţi prenumele dvs.\n",2);
		why += checkName(theForm.lastname.value,"Introduceţi numele dvs.\n",2);
		why += checkName(theForm.address.value,"Introduceţi adresa dumneavoastră.\n",4);
		why += checkName(theForm.zip.value,"Introduceţi codul poştal.\n",4);
		why += checkName(theForm.city.value,"Introduceţi numele dumneavoastră de oraş.\n",2);		
        why += checkName(theForm.phone.value,"Introduceţi numărul dvs. de telefon, împreună cu codul de ţară.\n",10);   


		if (why != "")
		{
       			alert(why);
       			return false;
    		}
		return true;
	}
function checkLoginFormEN(theForm)
	{
    		var why = "";
    

		why += isValidEmail(theForm.email.value,"Please enter a valid email address.\n");
		why += checkName(theForm.password.value,"Please enter a password of at least 5 characters.\n",5);

		if (why != "")
		{
       			alert(why);
       			return false;
    		}
		return true;
	}
function checkLoginFormBG(theForm)
	{
    		var why = "";
    

		why += isValidEmail(theForm.email.value,"Intra intr-o valabila adresa e-mail.\n");
		why += checkName(theForm.password.value,"Intra intr-o parola de cel putin 5 personaje.\n",5);

		if (why != "")
		{
       			alert(why);
       			return false;
    		}
		return true;
	}
function checkOnlyMail(theForm)
	{
    		var why = "";
    

		why += isValidEmail(theForm.email_to_send.value,"Intra intr-o valabila adresa e-mail.\n");

		if (why != "")
		{
       			alert(why);
       			return false;
    		}
		return true;
	}
function checkOnlyMailEN(theForm)
	{
    		var why = "";
    

		why += isValidEmail(theForm.email_to_send.value,"Please enter a valid email address.\n");

		if (why != "")
		{
       			alert(why);
       			return false;
    		}
		return true;
	}	
	
function checkUpdateEN(theForm)
	{
    		var why = "";
    

		why += isValidEmail(theForm.email.value,"Please enter a valid email address.\n");
		why += checkName(theForm.paswd.value,"Please enter a password of at least 5 characters.\n",5);
		why += checkName(theForm.user_code.value,"Please enter the characters you see on the picture.\n",6);
		why += checkName(theForm.firstname.value,"Please enter your firstname.\n",2);
		why += checkName(theForm.lastname.value,"Please enter your lastname.\n",2);
		why += checkName(theForm.address.value,"Please enter your address.\n",4);
		why += checkName(theForm.zip.value,"Please enter your zip code.\n",4);
		why += checkName(theForm.city.value,"Please enter your city.\n",2);		
        why += checkName(theForm.phone.value,"Please enter your phone number along with your country code.\n",10);
		if (why != "")
		{
       			alert(why);
       			return false;
    		}
		return true;
	}

	function checkWholeFormRegisterEN(theForm)
	{
    		var why = "";
    
		why += isValidEmail(theForm.email.value,"Please enter a valid email address.\n");
		why += checkName(theForm.paswd.value,"Please enter a password of at least 5 characters.\n",5);
		why += checkName(theForm.user_code.value,"Please enter the characters you see on the picture.\n",6);
		why += checkName(theForm.firstname.value,"Please enter your firstname.\n",2);
		why += checkName(theForm.lastname.value,"Please enter your lastname.\n",2);
		why += checkName(theForm.address.value,"Please enter your address.\n",4);
		why += checkName(theForm.zip.value,"Please enter your zip code.\n",4);
		why += checkName(theForm.city.value,"Please enter your city.\n",2);		
        why += checkName(theForm.phone.value,"Please enter your phone number along with your country code.\n",10);



		
		if (why != "")
		{
       			alert(why);
       			return false;
    		}
		return true;
	}
	
	function isValidEmail(str,error)
	{
		if ((str.indexOf(".") > 3) && (str.indexOf("@")) > 0)
		{
   			error="";
   		}
 		return error;
	}

	function checkName (strng,error,min_size)
	{
  		if ((strng.length < min_size) )
		{
    		}
		else
		{
			error="";	
		}

		return error;

	}
	function Checknum(obj,error){


		//var valid = "0123456789.";
		var valid = "0123456789"
		
		ph=obj.value;
		
		for (var i=0; i < ph.length; i++) {
		temp = ph.substring(i, i+1);
		//alert ("tmmp is--"+temp+"--");
			if (valid.indexOf(temp) == "-1") {
				//obj.value="";
				
				//obj.select();
				//obj.focus();
				
				return error;
			}
	
		}
		error="";
		return error;

}
function checkmail(email){
	frames['iframePreloader'].location.href='check_email.php?lang=1&email='+email;	
}
function checkmailen(email){
	frames['iframePreloader'].location.href='check_email.php?lang=2&email='+email;	
}

