
function my_Request(fisier, zona, cale_imagine) {
 //   document.getElementById(zona).innerHTML =  in_table(cale_imagine);
    new Ajax.Updater(zona, fisier, {asynchronous:true, evalScripts:true});
}

/*
 * onclick="my_Post('fisier','div_id','camp1_cam2_camp3');" >
 * 
 */

function my_Post(page, zona, post_body) {			//	my_Post('post.php','post_content')

	var opt = {
    	// Use POST
    	method: 'post',
    	// Send this lovely data
	    postBody: p_body(post_body),
    	// Handle successful response
	    onSuccess: function(t) {
		//	alert('ok');
	    	document.getElementById(zona).innerHTML = t.responseText;
	    // 	alert(t.responseText);
    	},
    	// Handle 404
    	on404: function(t) {
        	alert('Error 404: location "' + t.statusText + '" was not found.');
    	},
    	// Handle other errors
    	onFailure: function(t) {
        	alert('Error ' + t.status + ' -- ' + t.statusText);
    	}
	}
	new Ajax.Request(page, opt);	
}

function p_body(post_body) {
	var variabile = post_body.split("_");
	var sir_final = "";
	for(var i = 0; i < variabile.length; i++) {
		sir_final = sir_final+variabile[i]+"="+document.getElementById(variabile[i]).value+"&"
		
	//	alert (variabile[i]+" = "+document.getElementById(variabile[i]).value);
	}
	sir_final=sir_final.substr(0,sir_final.length-1);
	
//	alert(sir_final);
	return sir_final;
}


function in_table(cale_imagine){
	var s = "";
	s = s + "<table border='0' cellpadding='0' cellspacing='0' width='90%' height='90%' align='center'>";
	s = s + "<tr valign='middle'>";
	s = s + "<td align='center'>";
	s = s + "<img src='"+cale_imagine+"' border='0' />";
	s = s + "</td></tr></table>";
	return s;
}