function setTitle(t){
	document.title = t;
}

String.prototype.trim = function() { 
	return this.replace(/^\s+|\s+$/, '');
};


function salva(){
	var v = tinyMCE.get('txt-area-label').getContent();
	v = ReplaceAll(v, '&', '%26');
	Richiesta('admin/insert.php?action=new-news&value=' + v, 'confirmation');
}
function resetModificaDiv(){
	tinyMCE.execCommand('mceSetContent',false, initialValue);
}


function newConcerto(){
	var p = "admin/insert.php?action=new-concert";
	if(isNaN(document.getElementById('giorno').value)){
		alert("controlla giorno");
		return;
	}
	if(isNaN(document.getElementById('mese').value)){
		alert("controlla mese");
		return;
	}
	if(isNaN(document.getElementById('anno').value)){
		alert("controlla anno");
		return;
	}
	p += "&giorno=" + document.getElementById('giorno').value;
	p += "&mese=" + document.getElementById('mese').value;
	p += "&anno=" + document.getElementById('anno').value;
	p += "&citta=" + document.getElementById('citta').value;
	p += "&luogo=" + ReplaceAll(document.getElementById('luogo').value, '&', '%26');
	p += "&info=" + ReplaceAll(document.getElementById('info').value, '&', '%26');
//	alert(p);
	Richiesta(p, 'confirmation');
}

function addVideo(){
	var p = "admin/insert.php?action=new-video";
	p += "&prima=" + ReplaceAll(document.getElementById('prima').value, '&', '%26');
	p += "&seconda=" + ReplaceAll(document.getElementById('seconda').value, '&', '%26');
	p += "&terza=" + ReplaceAll(document.getElementById('terza').value, '&', '%26');
	p += "&id_vimeo=" + ReplaceAll(document.getElementById('id_vimeo').value, '&', '%26');
	p += "&preview=" + ReplaceAll(document.getElementById('preview').value, '&', '%26');
	//alert(p);
	Richiesta(p, 'confirmation');
}

function eliminaNews(id){
	Richiesta("admin/insert.php?action=elimina-news&id=" + id, 'confirmation');
}

function eliminaConcerto(id){
	Richiesta("admin/insert.php?action=elimina-concerto&id=" + id, 'confirmation');
}

function eliminaVideo(id){
	Richiesta("admin/insert.php?action=elimina-video&id=" + id, 'confirmation');
}


function include(filename){
	var head = document.getElementById('scripts-div');
	script = document.createElement('script');
	script.src = filename;
	script.type = 'text/javascript';
	head.appendChild(script);
}