﻿var ParentTemplate = new Class ({
    initialize : function () {
        //imgMouseOverEvents('_off', '_on', 'img.autoMouseOver');
        //imgMouseOverEvents('_off', '_on', 'input.autoMouseOver');
        
        if ( $('top-nav-edit') )
        {
            $('top-nav-edit').addEvent('click', function(e) {
                //alert("here");
            });
        } 
        if ( $('top-nav-password') )
        {
            $('top-nav-password').addEvent('click', function(e) {
                // popup the change password div.
                if ( $('passwordchange') )
                {
                    this.passwindow = new StickyWinModal({
                        content: $('passwordchange'),
                        relativeTo: $('top-nav-password'),
                        position: 'lowerLeft'
                    });
                    $('passwordchange').show();
                }
            }.bind(this));
        } 
        if ( $('changepwd'))
        {
			this.validator = new FormValidator('changepwd',{serial: true});
			$('changepwd').addEvent('submit',function(e) {
				new Event(e).stop();
				//alert($('changepwdfrm').toQueryString());
				if ( this.validator.validate() ) {
					$('changepwd').set('send', {onComplete: function(response) {
						this.passwindow.hide();
					}.bind(this)});
					//Send the form.
					$('changepwd').send();
				}
			}.bind(this));
            
        }
    }
});

window.addEvent('domready', function (e) {
    var pTemplate = new ParentTemplate();
});