
function deleteMotivationstips( userid, motivationstipsid ) {
	var divname = motivationstipsid + "_motivationstips";
	var elementname = "mainmessagespot";
	paramurl = "userid=" + userid + "&motivationstipsid=" + motivationstipsid + "&optype=2";
//	showAlertMessage( paramurl );
	emptyElement( "subcontentspot" );

	if( confirm( "Är du säker på att du vill ta bort motivationstipset?" ) ) {
		var deletemotivationstipsrequest = createRequest();
		var url = "usermotivationstipshandler.php";
		deletemotivationstipsrequest.open( "POST", url, true );
		deletemotivationstipsrequest.onreadystatechange = function doDOMChanges() {
			if( deletemotivationstipsrequest.readyState == 4 ) {
				if( deletemotivationstipsrequest.status == 200 ) {
					var response = deletemotivationstipsrequest.responseText;
					if( response == 1 ) {
						removeElement( divname );
						emptyElement( elementname );
					}
					else {
						updateElement( elementname, "Motivationstipset kunde inte tas bort.<BR>Felmeddelande: " + response );
					}
				}
				else {
					updateElement( elementname, "Det uppstod ett fel när motivationstipset skulle tas bort!<BR>Felkod: " + deletemotivationstipsrequest.status );
				}
			}
			else {
				Element.update( elementname, "<IMG SRC=pics/loading.gif BORDER=0 ALIGN=BOTTOM STYLE=\"text-align:bottom;\"> Tar bort motivationstips... Var god v&auml;nta..." );
			}
		}
		deletemotivationstipsrequest.setRequestHeader( "Content-Type", "application/x-www-form-urlencoded" );
		deletemotivationstipsrequest.send( paramurl );
	}
}

function deleteMotivationstipsPic( userid, motivationstipsid ) {
	paramurl = "userid=" + userid + "&motivationstipsid=" + motivationstipsid + "&optype=1";
//	showAlertMessage( paramurl );
	if( confirm( "Är du säker på att du vill ta bort bilden till motivationstipset?" ) ) {
		var deletemotivationstipspicrequest = createRequest();
		var url = "usermotivationstipshandler.php";
		var elementname = "mainmessagespot";
		deletemotivationstipspicrequest.open( "POST", url, true );
		deletemotivationstipspicrequest.onreadystatechange = function doDOMChanges() {
			if( deletemotivationstipspicrequest.readyState == 4 ) {
				if( deletemotivationstipspicrequest.status == 200 ) {
					var response = deletemotivationstipspicrequest.responseText;
					if( response == 1 ) {
						removeElement( "motivationtipspicspot" );
						emptyElement( elementname );
					}
					else {
						updateElement( elementname, "Motivationstipsbilden kunde inte tas bort.<BR>Felmeddelande: " + response );
					}
				}
				else {
					updateElement( elementname, "Det uppstod ett fel när motivationstipsbilden skulle tas bort!\nFelkod: " + deletemotivationstipspicrequest.status );
				}
			}
			else {
				updateElement( elementname, "<IMG SRC=pics/loading.gif BORDER=0 ALIGN=BOTTOM STYLE=\"text-align:bottom;\"> Tar bort motivationstipsbild... Var god v&auml;nta..." );
			}
		}
		deletemotivationstipspicrequest.setRequestHeader( "Content-Type", "application/x-www-form-urlencoded" );
		deletemotivationstipspicrequest.send( paramurl );
	}
}

