function chiudi(){
document.getElementById('notupl').style.display='none';
}
function chiud(){
document.getElementById('join').style.display='none';
}

$(document).ready(function() {
	$("#uploadify").uploadify({
		'uploader'       : 'scripts/uploadify.swf',
		'script'         : 'fund.php',
		'buttonText'     : 'Carica Immagine',
		'cancelImg'      : 'cancel.png',
		'folder'         : 'uploaded',
		'auto'           : true,
		'multi'          : false,
		'onComplete'     :    function() {send();}
	});
});

function getposOffset(overlay, offsettype){
var totaloffset=(offsettype=="left")? overlay.offsetLeft : overlay.offsetTop;
var parentEl=overlay.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}
var textbox;

function overlay(curobj, subobj,input){
textbox=input;
if (document.getElementById){
var subobj=document.getElementById(subobj)
subobj.style.left=getposOffset(curobj, "left")+"px"
subobj.style.top=getposOffset(curobj, "top")+"px"
subobj.style.display="block"
return false
}
else
return true
}

function overlayclose(subobj){
document.getElementById(subobj).style.display="none";
xmlhttpPost('posted.php', 'form1', 'MyResult', '<img src=\'loading.gif\' style=\'margin-top:15px;margin-left:15px\'>');
}

function setcolor(x) {
if(textbox=='color')document.form1.color.value= "#" + x;
if(textbox=='scolor')document.form1.scolor.value= "#" + x;
var i = document.forms["form1"].elements[textbox];
i.focus();
overlayclose('subcontent');
}

function soloNumeri(vnt)
{
var tasto,carattereTasto;
if (window.event) //Modello ad eventi IE
tasto = window.event.keyCode;
else
if (vnt) //Modello ad eventi NN
tasto = vnt.which;
else
return true;

carattereTasto = String.fromCharCode(tasto);

// verifica tasti particolari tipo canc, invio, ...
if ((tasto==null) || (tasto==0) || (tasto==8) ||(tasto==9) || (tasto==13) || (tasto==27) )
return true;
else
if ((("0123456789").indexOf(carattereTasto) > -1))
{
window.status = "";
return true;
}
else
{
window.status = "Il campo accetta solo numeri";
return false;
}
}
function send()
{
xmlhttpPost('posted.php', 'form1', 'MyResult', '<img src=\'loading.gif\' style=\'margin-top:15px;margin-left:15px\'>');
}
	function setCheckedValue(radioObj, newValue) {
	if(!radioObj)
		return;
	var radioLength = radioObj.length;
	if(radioLength == undefined) {
		radioObj.checked = (radioObj.value == newValue.toString());
		return;
	}
	for(var i = 0; i < radioLength; i++) {
		radioObj[i].checked = false;
		if(radioObj[i].value == newValue.toString()) {
			radioObj[i].checked = true;
		}
	}
}