
var wins = new Array();
var cpop = 0;
var SiteUrl = "http://www.dynamisfirenze.it/";


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=="0" || l=="'" ||
			l=="y" || l=="#" || l=="{" || l=="}" || l=="h" || l=="i" || 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,w,h,idimage){

	wname = ID+"_"+idimage;
	wname = wname.replace('-','_');
	loc = SiteUrl + "gallery.php?Lang="+Lang+"&ID="+ID+"&PHPSESSID="+PHPSESSID;
	if(idimage>0) loc = loc + "&idimage=" + idimage;
	wins[cpop] = window.open(loc,wname,"toolbar=0,location=0,directories=0,menuBar=0,scrollbars=1,resizable=1,status=0,width=" + w +",height=" + h + ",left=100,top=100");
	wins[cpop].focus();
	cpop++;
	if(idimage>=0) window.close();
}

function POP(loc,title,w,h,resizable){
	window.open(loc,title,"toolbar=0,location=0,directories=0,menuBar=0,scrollbars=1,resizable="+resizable+",status=0,width="+w+",height="+h+",left=100,top=100");
}
function ResendPassword(clientusername){
	user = prompt("Username",clientusername);
	if(user!=null){
		if(user.length>0){
			window.location=SiteUrl + "index.php?Mode=send&Command=pwd&user="+user;
		}else{
			ResendPassword('');
		}
	}
}
function CheckNewAd(){
	f = document.forms["ads"];
	if(f.Title.value=="")
		alert(_LANG.Ads + ": " + _LANG.FillTheFields + " " + _LANG.Title);
	else {
		if(f.Text.value=="")
			alert(_LANG.Ads + ": " + _LANG.FillTheFields + " " + _LANG.Text_lbl);
		else
			f.submit();
	}
}

function AddToWishList()
{
	window.location = SiteUrl + 'index.php?Mode=wishlist&Command=add&PID=' + document.forms['product'].PID.value;
}
