
function popup(url,width,height){
	window.open(url,'popup','scrollbars=yes, top=80, left=80, menubar=no, resizable=no, status=no, width='+width+', height='+height);
}

function conferma(messaggio, url){
	if(confirm(messaggio)){
		return true;
	}
	return false;
}


function chk_txt(o,v){
	if(o.value.search('[a-zA-Z0-9]') == -1){
		if(arguments.length==1) alert('Campo ' + o.name + ' errato');
		else if(arguments.length==2) alert(v);
		o.focus();
		return false;
	}
	return true;
}

function chk_int(o,m){
	if(!o.value || o.value.search('[^0-9]') != -1){
		if(arguments.length==1) alert('Campo ' + o.name + ' errato');
		else if(arguments.length==2) alert(m);	
		o.focus();
		return false;
	}
	return true;
}
//togliere http!!!
function chk_url(o){
	if(o.value.search('[a-z]+://[a-zA-Z0-9]+\.[a-zA-Z0-9]+') == -1){
		alert('Campo ' + o.name + ' errato');
		o.focus();
		return false;
	}
	return true;
}
function chk_url1(o,m){
	if(o.value.search('[a-zA-Z0-9]+\.[a-zA-Z0-9]+') == -1){
		if(arguments.length==2){
			alert(m);
			o.focus();
		}
		return false;
	}
	return true;
}

function chk_passwd(o,v){
	if(o.value.search('[a-zA-Z0-9]') == -1 || o.value.length < 9 ){
		if(arguments.length==1) alert('Campo ' + o.name + ' errato');
		else if(arguments.length==2) alert(v);
		o.focus();
		return false;
	}
	return true;
}

function chk_passwd2(o1,o2,v){
	if( o1.value != o2.value ){
		if(arguments.length==1) alert('Campo ' + o.name + ' errato');
		else if(arguments.length==2) alert(v);
		o.focus();
		return false;
	}
	return true;
}


function azzera(url){
	window.location.href = url;
}
function chk_email(o,d){
	if(o.value.search("^[0-9a-zA-Z]([-_.]?[0-9a-zA-Z])*@[0-9a-zA-Z]([-.]?[0-9a-zA-Z])*\\.[a-zA-Z]{2,4}$") == -1){
		alert(d);
		o.focus();
		return false;
	}
	return true;
}
function chk_select(o,d){
	if(!o[o.selectedIndex].value || !o.selectedIndex){
		alert(d);
		o.focus();
		return false;
	}
	return true;
}

function chk_radiobutton(o,m){
	/*
	var ctrl = false;
	
	for(i;i<o.length;i++){
		if( o.checked ){
			ctrl = true;
			break;
		}
	}
	
	if(!ctrl){
		alert(m);
		return false;
	}
	
	return true;
	*/
	return false;
}

//////////////////////////////////////////////////////////////////////////

function chk_aut(){
	if(!document.contatti.check_privacy.checked){
		alert("E' necessario fornire il proprio consenso");
	     document.registrazione.focus();
	     return false;
	}else{
	 return true;
	}
}

function chk_aut2(){
	if(!document.registrazione.flag_privacy2.checked){
		alert("E' necessario fornire il proprio consenso");
	     document.registrazione.focus();
	     return false;
	}else{
	 	return true;
	}
}




