function removeComment(commentID) {
	//if (confirm('Haluatko varmasti poistaa tämän kommentin?')) {
		if (comment = document.getElementById('comment_' + commentID)) {
			var reason = prompt("Poiston syy?", '');
			
			if (reason != null) {
				document.getElementById('ajaxFrame').src  = "/removeComment.php?commentID=" + commentID + "&reason=" + reason;		
				comment.style.display = 'none';	
			}
		} else {
			alert('Kommenttia ei löytynyt');
		}
	//}
}

function removeMessage(messageID) {
	if (message = document.getElementById('message_' + messageID)) {
		
		var reason = prompt("Poiston syy?", '');
		
		// if cancel is pressed instead of ok
		if (reason != null) {
			document.getElementById('ajaxFrame').src  = "/removeMessage.php?messageID=" + messageID + "&reason=" + reason;		
			message.style.display = 'none';	
		}
	} else {
		alert('Viestiä ei löytynyt');
	}
}

function banUser(userID) {
    var reason = prompt("Porttikiellon syy?", ''); 

    if (reason != null) {
        var banWindow = window.open('/admin/ban_user.php?user_id=' + userID + '&reason=' + reason, 'banWindow', "location=1,status=1,scrollbars=1,width=640,height=480");
    } else {
        alert('Käyttäjän poisto keskeytetty');
    }
}

function changePetitionLockStatus(petitionID) {
    var reason = prompt("Syy?", ''); 

    if (reason != null) {
        var banWindow = window.open('/admin/change_is_locked_value.php?petition_id=' + petitionID + '&reason=' + reason, 'banWindow', "location=1,status=1,scrollbars=1,width=640,height=480");
    } else {
        alert('Toiminto keskeytetty');
    }
}

function changePublicityValue(petitionID) {
    var publicity;
    if (confirm('Linkitetäänkö')) {
        publicity = 1;
    } else {
        publicity = 0;
    }
    
    var windowX = window.open('/admin/petition_change_publicity.php?petition_id=' + petitionID + '&publicity=' + publicity, 'banWindow', "location=1,status=1,scrollbars=1,width=640,height=480");        
}



function hide(elementID) {
	document.getElementById(elementID).style.visibility = 'hidden'; 
}

function show(elementID) {
	document.getElementById(elementID).style.visibility = 'visible'; 
}

function openDefaultWindow(url) {
    var windowX = window.open(url, 'defaultWindow', "location=1,status=1,scrollbars=1,width=640,height=480");
}

function fbs_click() {
    u=location.href;
    t=document.title;
    window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');
}
