function isEmpty(s){
	return (s==null || s.length==0)
}

function isWhitespace(s){
	var i;
	var whitespace;
	
	whitespace=" \t\n\r";
	for(i=0; i<s.length; i++)   
		if(whitespace.indexOf(s.charAt(i))==-1) return false;
	
    return true;
}

function isEmail(s){
    if (isWhitespace(s)) return false;
    var i = 1;
    var sLength = s.length;
    while (i<sLength && s.charAt(i) != "@")
    	i++;

    if ((i >= sLength) || (s.charAt(i) != "@")) return false;
    else i += 2;
    while ((i < sLength) && (s.charAt(i) != "."))
    	i++;
    
    if ((i >= sLength - 1) || (s.charAt(i) != ".")) return false;
    else return true;
}

function checktext(testo){
	i=0;
	while (i < testo.length){
		l = testo.substr(i, 1);
		if (l=="\"" || l==" " || l=="&" || l=="?" || l=="=" || l=="." || l=="'" ||  
			l=="/" || l=="+" || l=="%" || l=="!" || l=="£" || l=="|" || l=="(" ||
			l==")" || l=="ì" || l=="[" || l=="]" || l==" " || l=="°" || l=="§" ||
			l=="ù" || l=="#" || l=="{" || l=="}" || l=="è" || l=="é" || l=="*" ||
			l==":" || l=="," || l==";" || l=="<" || l==">")
			return false;
		i++;
	}

	return true;
}

function checkquotes(testo){
	i = 0;
	while (i < testo.length){
		if (testo.substr(i, 1) == "\"")
			return false;
		i++;
	}

	return true;
}

//////////
function SendMsg(f){
	f.Command.value="sendmsg";
	f.submit();
}
function ConfirmOrder(f){
	f.Command.value="confirm";
	f.submit();
}
function ContinueOrder(f){
	f.Command.value="continue";
	f.submit();
}
function CancelOrder(f){
	f.Command.value="cancel";
	f.submit();
}
function GalleryPOP(Lang, ID, PHPSESSID){
	loc="gallery.php?Lang="+Lang+"&ID="+ID+"&PHPSESSID="+PHPSESSID;
	window.open(loc,Lang,"toolbar=0,location=0,directories=0,menuBar=0,scrollbars=1,resizable=1,status=0,width=500,height=450,left=100,top=100");
}
function ResendPassword(clientusername){
	user = prompt("Username",clientusername);
	if(user!=null){
		if(user.length>0){
			window.location="index.php?Mode=send&Command=pwd&user="+user;
		}else{
			ResendPassword();
		}
	}
}

