function reportphotoadult_confirmed(htmltextelement,imgchechsum)
{
    new Ajax.Request('/a_adult_report.php', {
            method: 'post',
            parameters: { i: imgchechsum },
            onSuccess: function(transport) { 
				if (transport.status == 200) {
                    var data = transport.responseJSON;
                    if (data) {
                        $(''+htmltextelement+'').update('Thank you for reporting this image.');
                    } else {
                        $(''+htmltextelement+'').update('Sorry, failed to report');
                    }
                } else {
                    $(''+htmltextelement+'').update('Sorry, failed to report');
                }
			}
	});
}

function reportphotoadult(htmltextelement,useruid,imgchechsum)
{
	$(''+htmltextelement+'').innerHTML = 
		'<span style="color:gray;font-weight:bold">Click <a href="javascript:void(0)" class="owned_menu_link" ' +
		'onclick="reportphotoadult_confirmed('+htmltextelement+','+imgchechsum+')">' + 
		'Yes</a> to confirm NSFW</span>';
}

function clearphotomark(imgchechsum)
{
    if (confirm("Clear this mark?")) {
        new Ajax.Request('/a_adult_report.php', {
            method: 'post',
            parameters: { i: imgchechsum, a: 0 },
            onSuccess: function(transport) {
                if (transport.status == 200) {
                    var data = transport.responseJSON;
                    if (data) {
                        if (data['error']){
                           alert(data['html']);
                        } else {
                            window.location.reload();
                        }
                    } else {
                        alert('Failed operation');
                    }
                } else {
                    alert('Failed operation');
                }
            }
        });
    }
}

function photomarkadult(imgchechsum,uid)
{
    if (confirm("Mark as NSFW?")) {
        new Ajax.Request('/a_adult_report.php', {
            method: 'post',
            parameters: { i: imgchechsum, a: 1, u: uid },
            onSuccess: function(transport) {
                if (transport.status == 200) {
                    var data = transport.responseJSON;
                    if (data) {
                        if (data['error']){
                           alert(data['html']);
                        } else {
                            window.location.reload();
                        }
                    } else {
                        alert('Failed operation');
                    }
                } else {
                    alert('Failed operation');
                }
            }
        });
    }
}

function photomarknoprimary(imgchechsum,uid)
{
    if (confirm("Mark as not allowed as primary?")) {
        new Ajax.Request('/a_adult_report.php', {
            method: 'post',
            parameters: { i: imgchechsum, a: 2, u: uid },
            onSuccess: function(transport) {
                if (transport.status == 200) {
                    var data = transport.responseJSON;
                    if (data) {
                        if (data['error']){
                           alert(data['html']);
                        } else {
                            window.location.reload();
                        }
                    } else {
                        alert('Failed operation');
                    }
                } else {
                    alert('Failed operation');
                }
            }
        });
    }
}





