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 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=310,left=50,top=50");
}
