var dlgForgotPass = null;
var noteMgt = null;

function onDocumentReady() {
	noteMgt= HICONV.ServMsgNote();
	customerWorkspace._path = Constants.getDwrUrl(); // DEPLOYMENT ISSUE
	
	//lblForgotPass
	YAHOO_adst.util.Event.addListener(
        'lblForgotPass',
        'click',
        function(e, obj) {//usnPass
           dlgForgotPass.show();
        },
        this
    );
        		
	var _repeatTaskYes = function() {
	    if (YAHOO_adst.util.Dom.get('usnPass').value == ''){
	        noteMgt.doAlert('Please insert your email.');
	        return;
	    }
	    customerWorkspace.resetPassword( YAHOO_adst.util.Dom.get('usnPass').value,
	    	{
    			callback: function(_status) {
					if (_status == -1) {
					    noteMgt.doAlert('User with this email does not exist in our database. Please, check email you inserted.');
					} else if (_status == 0) {
					noteMgt.doAlert('Action complete. A new password has been sent to your e-mail');
					}
				},
    			errorHandler: function(errorString, exception) {
    				noteMgt.doAlert('Errors occured during process of sending you access data. Please, contact our support department on support@hiconversion.com');
    			}
			}
		);
	    dlgForgotPass.hide();
	};
	var _repeatTaskNo = function() {
	    dlgForgotPass.hide();
	};
	document.getElementById('dlgWarning').style.visibility = '';
	dlgForgotPass = new YAHOO_adst.widget.Dialog('dlgWarning', {
                    width:"350px", 
                    fixedcenter: true, 
                    constraintoviewport: true, 
                    close:true, 
                    zIndex: 20000, 
                    draggable: true,
                    visible: false,
                    scrollable:true,
                    modal: true,
	            buttons: [ {text:"OK", handler:_repeatTaskYes, isDefault:true },
				            { text:"Cancel",  handler:_repeatTaskNo} ]});
	            dlgForgotPass.render();
}
//YAHOO_adst.util.Event.onDOMReady(onDocumentReady, this, true);
