

function delete_account(){

	var delacctFailure = function(){};

	var delacct1Cancel = function(){
		delacctpanel1.hide();
	};

	var delacctform = 'By continuing, you will be able to remove your account information from our server.<P>To ensure that this is conciously performed, it will be a multi-step process.<P>To continue, press the "Start Account Deletion Process" button below.';

	var delacct1Success = function(){
		delacctpanel1.hide();
		delete_account2();		
	};

        var delacctpanel1 = new YAHOO.widget.Dialog("delacctpanel1",  
                                                 { width: "450px", 
                                                      fixedcenter: true, 
                                                      close: true, 
                                                      draggable: false, 
                                                      zindex: +3,
                                                      modal: true,
                                                      visible: false, 
				  		      buttons : [ { text:"Start Account Deletion Process", handler: delacct1Success, isDefault:false },
								      { text:"Cancel", handler:delacct1Cancel, isDefault: true } ]
                                                    } 
                                                );
 
        delacctpanel1.setHeader("Delete Account (Confirm) - Step 1 of 3:");
        delacctpanel1.setBody(delacctform);
        delacctpanel1.render(document.body);
	delacctpanel1.show();



}

function delete_account2(){

	var delacct2Failure = function(){};

	var delacct2Cancel = function(){
		delacctpanel2.hide();

	};

	var delcontactform = '<span class="error" id="errorform"></span>Please offer a comment on why you are choosing to delete your account.  We take feedback like this very seriously as it gives us insight on what we can do to improve our service and address the needs of our user base.<BR><center>	\
		<form action="functions/delete_account.php" method="get">	\
				<input type="hidden" name="subject" value="[Account Termination Comment]" /><br /><br />	\
			<label id="contact_textmsg" for="contact_text">&nbsp;Please tell us why you are canceling your account:</label><br /><span class="error" id="errormessage"></span>\
				<textarea cols="50" rows="10" name="text" id="contact_text" class="inputbox required"></textarea><br />	\
		</form></center>';

	var delacct2Submit = function(){
		delacctpanel2.submit();
	};

	var delacct2Success = function(o) {
			var messages = YAHOO.lang.JSON.parse(o.responseText);			
			if(messages.error){
				error_msg(messages.error);
			}else{
				delacctpanel2.hide();		
				delete_account3();
			}
	};


        var delacctpanel2 = new YAHOO.widget.Dialog("delacctpanel2",  
                                                 { width: "450px", 
                                                      fixedcenter: true, 
                                                      close: true, 
                                                      draggable: false, 
                                                      zindex: +3,
                                                      modal: true,
                                                      visible: false, 
				  		      buttons : [ { text:"Provide Feedback", handler:delacct2Submit, isDefault:true },
								      { text:"Cancel", handler:delacct2Cancel } ]
                                                    } 
                                                );

        delacctpanel2.callback = { success: delacct2Success,failure: delacct2Failure };
	delacctpanel2.setHeader("Delete Account (Provide Comments) - Step 2 of 3:");
	delacctpanel2.setBody(delcontactform);
	delacctpanel2.render(document.body);
	delacctpanel2.show();
}

function delete_account3(){
	var delacct3Failure = function(){};

	var delacct3Cancel = function(){
		delacctpanel3.hide();
	};
	var delacct3form = '<span id="cmsg"></span>Thank you for your feedback.  This is your final Account Deletion confirmation.  By pressing the DELETE ACCOUNT button below, you are taking the final action required to FULLY delete your account.  <B>Are you sure that this is what you want to do?</B>  Click DELETE ACCOUNT to continue, and Cancel to exit this screen and return to your Dashboard.'; 

	var delacct3Success = function(){

				var request = YAHOO.util.Connect.asyncRequest('GET', 'functions/delete_account.php?f=1'); 
				logmeout();
				delacctpanel3.hide();
				thank_you();
			
	};


	var delacctpanel3 = new YAHOO.widget.Dialog("delacctpanel3",  
                                                 { width: "450px", 
                                                      fixedcenter: true, 
                                                      close: true, 
                                                      draggable: false, 
                                                      zindex: +3,
                                                      modal: true,
                                                      visible: false, 
				  		      buttons : [ { text:"CLICK TO DELETE ACCOUNT", handler:delacct3Success, isDefault:true },
								      { text:"Cancel", handler:delacct3Cancel } ]
                                                    } 
                                                );

					        delacctpanel3.callback = { success: delacct3Success,failure: delacct3Failure };
        					delacctpanel3.setHeader('Delete Account [Final Confirm] - Step 3 of 3:');
        					delacctpanel3.setBody(delacct3form);
        					delacctpanel3.render(document.body);
						delacctpanel3.show();

}


function thank_you(){
	var thankyouCancel = function(){
		thankyou.hide();
	};

	var thankyoumessage = "We are sorry to see you go, however we appreciate that you gave us a try. MyBizHomepage is supported by an continuous development plan that takes our user's needs very seriously. If we were unable to meet your needs at this time, it is possible that we may at some point in the future.  Please keep us in mind, and check back from time to time to see if we can help you at that point.<P>Thank You,<P>Peter Justen<BR>Founder, MyBizHomepage, Inc.";
	var thankyou = new YAHOO.widget.Dialog("thankyou",  
                                                 { width: "450px", 
                                                      fixedcenter: true, 
                                                      close: true, 
                                                      draggable: false, 
                                                      zindex: +3,
                                                      modal: true,
                                                      visible: false, 
				  		      buttons : [ { text:"Click to Close", handler: thankyouCancel, isDefault:true }  ]
                                                    } 
                                                );

        					thankyou.setHeader('Thank you for using MyBizHomepage!');
        					thankyou.setBody(thankyoumessage);
        					thankyou.render(document.body);
						thankyou.show();

}

function error_msg(error_m){
	var errorCancel = function(){
		error.hide();
	};

	var error = new YAHOO.widget.Dialog("error",  
                                                 { width: "450px", 
                                                      fixedcenter: true, 
                                                      close: true, 
                                                      draggable: false, 
                                                      zindex: +3,
                                                      modal: true,
                                                      visible: false}  
                                                    
                                                );

        					error.setHeader('Error:');
        					error.setBody(error_m);
        					error.render(document.body);
						error.show();

}
