function change_pass(){
	var chgpassform = '<span class="error" id="errorform"></span> \
		   <form method="get" action="functions/change_pass.php" id="chpass">	\
		   <table><tr>	\
			<td><label id="pwmsg" for="password">Password:</label></td>	\
	  		<td><span class="error" id="errorpassword"></span><input class="inputbox" name="password" type="password" id="password" size="40" value="" /> *</td>	\
			</tr><tr>	\
			<td><label id="pw2msg" for="password2">Verify Password:</label></td>	\
			<td><span class="error" id="errorpassword2"></span><input class="inputbox" type="password" id="password2" name="password2" size="40" value="" /> *</td>	\
			</tr>	\
			</table>	\
			Fields marked with an asterisk (*) are required.<BR>	\
		   </form>';


	var chgpassSubmit = function() {
		chgpasspanel.submit();
	};
	var chgpassCancel = function() {
		chgpasspanel.cancel();
		dashboard();
	};


	var chgpassSuccess = function(o) {

		chgpasspanel.hide();
		document.getElementById('cash').innerHTML = '<IMG SRC="images/sbdc/mybizhomepage.png" width=670>';
		document.getElementById('receivables').innerHTML = '<IMG SRC="images/sbdc/mybizhomepage.png" width=670>';
		document.getElementById('payables').innerHTML = '<IMG SRC="images/sbdc/mybizhomepage.png" width=670>';
		document.getElementById('inventory').innerHTML = '<IMG SRC="images/sbdc/mybizhomepage.png" width=670>';
		var passsuccessdialog = new YAHOO.widget.Panel("respdialog", {width: "450px", fixedcenter: true, close: true, draggable: false, zindex: 4, modal: true, visible: false});
		var messages = YAHOO.lang.JSON.parse(o.responseText);
	
		if(messages.success){
		        passsuccessdialog.setHeader("Password Change Successful!");
	          	passsuccessdialog.setBody("You have successfully changed your password to '" + messages.success + "'. Please make a note of it.");
		}else{
		        passsuccessdialog.setHeader('<img src="images/cancel_f2.png" width="16"> Password Change Error:');
	          	passsuccessdialog.setBody(messages.error);
		}
                passsuccessdialog.render(document.body);
	  	passsuccessdialog.show();
		passsuccessdialog.hideEvent.subscribe( function (){getthedata();});	
	

	};

	var chgpassFailure = function(o) {};

 

        var chgpasspanel = new YAHOO.widget.Dialog("chgpasspanel",  
                                                 { width: "450px", 
                                                      fixedcenter: true, 
                                                      close: true, 
                                                      draggable: false, 
                                                      zindex: +3,
                                                      modal: true,
                                                      visible: false, 
				  		      buttons : [ { text:"Change Your Password", handler:chgpassSubmit, isDefault:true },
								      { text:"Cancel", handler:chgpassCancel } ]
                                                    } 
                                                );
	chgpasspanel.validate = function() {
						var data = this.getData();
						var val = 1;


				if (data.password == '') {
					document.getElementById("errorpassword").innerHTML = '<img src="images/cancel_f2.png" width="16"> You must provide a password. What password would you like to use?<br>';
					val=0;
				} else {
					document.getElementById("errorpassword").innerHTML = '';
				}

				if (data.password !== data.password2) {
					document.getElementById("errorpassword2").innerHTML = '<img src="images/cancel_f2.png" width="16"> Your password does not match.  Please type your password correctly in both password boxes.<br>'; 
					val=0;
				} else {
					document.getElementById("errorpassword2").innerHTML = '';
				}

				if(val == 0){
					document.getElementById("errorform").innerHTML = '<strong>There were errors on your form. Please correct by following the error messages provided.</strong><p>';
					return false;

				}else{
					return true;
				}

	};


        chgpasspanel.callback = { success: chgpassSuccess,failure: chgpassFailure };
        chgpasspanel.setHeader("Change Your Password:");
        chgpasspanel.setBody(chgpassform);
        chgpasspanel.render(document.body);
	chgpasspanel.show();

	chgpasspanel.hideEvent.subscribe( function (){getthedata();});
	document.getElementById('cash').innerHTML = '<IMG SRC="images/sbdc/mybizhomepage.png" width=670>';
	document.getElementById('receivables').innerHTML = '<IMG SRC="images/sbdc/mybizhomepage.png" width=670>';
	document.getElementById('payables').innerHTML = '<IMG SRC="images/sbdc/mybizhomepage.png"width=670>';
	document.getElementById('inventory').innerHTML = '<IMG SRC="images/sbdc/mybizhomepage.png" width=670>';
}


