function sendURL() { 

var sel = document.miaform.category;
var selStr = "nothing";
for(var i=0,a;a=sel[i];i++) {
selStr = (a.checked) ? (a.value) : (selStr);
}
var myfunc = function() { 
generalAjaxHandler("url","Problemi invio url, si consiglia di attendere qualche secondo e riprovare",null, null); 
} 
request = CreateXmlHttpReq(myfunc);
ajaxGetRand('/ajax_verify_url.php?url='+document.miaform.url.value,Handler);


function Handler(aa){ 
	if(aa!='ERROR'){
	document.getElementById('dinamico').innerHTML=aa;
	window.location = '/last';
	return true; }
	else
	return false; } 
} 

function submitForm() {
disableButton();
document.miaform.submit(); } 


function checkSendURL() {

disableButton();
var title=document.miaform.title.value;
var url=document.miaform.url.value;

	if (!validate(document.miaform.title.value, "^.*[^ ]+.*$", "Il titolo non puo' contenere caratteri speciali o essere vuoto","title"))
	{ 
	ableButton();
	return false; 

	} 

//	if (!validate(document.miaform.newsdescr.value, "^.*[^A-Za-z0-9_\'\"].*$", "La descrizione non puo' contenere caratteri speciali o essere vuota","newsdescr"))
//	{ 
//	return false; 
//	} 

	else {

	var regexUrl = /(ftp|http|https):\/\//;
	  	 if ((regexUrl.test(url)) )
		 {
		//window.alert("URL OK.");

			submitForm();
//		return checkDescr();

		 }
 		else
   		 {
	
		window.alert("Inserire un URL valido");
		warnField("url");
		ableButton();

	    }
		}


	return false;


}




function disableButton(){
document.getElementById("sendB2").disabled=true;
document.getElementById("sendB2").innerHTML="<img src='http://www.isola5.eu/script/rssbox/loading.gif' alt='loading' />"; 
}
function ableButton(){
document.getElementById("sendB2").disabled=false;
document.getElementById("sendB2").innerHTML='<a id="sendButton" href="/posta_ok" onclick="checkSendURL();return false;"><img src="images/posta_link_btn.png" border="0"></a>'; 
 }


function checkRadioCategory(IdRadio)
   {

if (   document.miaform.category[IdRadio-1].checked==false) {
   document.miaform.category[IdRadio-1].checked=true;
      }

	}


function checkRadioregione(IdRadio)
   {

if (   document.miaform.regione[IdRadio-1].checked==false) {
   document.miaform.regione[IdRadio-1].checked=true;
      }

	}