window.addEvent('domready',function() {
	if ($('signinform') !== null) {
//		code for help tips
		var n = new TinyAlert({skin:'snow'});
		$$('#babati,#pass,#cpass,#email').each(function(e){
			e.addEvent('focus', function(i){
				var a;
				switch(i.target.get('id')){
					case ('babati'):
						a = 'UserName';
						break;
					case('pass'):
						a = 'Password';
						break;
					case('cpass'):
						a = 'Confirm Password';
						break;
					default : a = 'E-Mail address';
				}
				n.show(a,STRINGS.NOTIFY[i.target.get('id')]);
			});
		});
//		code for image verification
		$('signupform').addEvent('submit',function(e){
			e.stop();
			var d = new UI.Disabler().show();
			var a = function(b){
				b.stop();
				$('code').set('value', $('code_shadow').get('value'));
	 			$('code_id').set('value', $('code_id_shadow').get('value'));
	 			document.forms[1].submit();
			};
			var y = new Request({
			 	method:'get',url:'/cgi-bin/lg.cgi',data:{run:'gen_image'},
			 	onSuccess: function(rx){
			 		var c = new Element('div',{'class':'whatever',html:rx });
			 		var s = $$('body')[0].getSize();
			 		c.setStyles({
					 	display: 'block',
						visibility: 'visible',
						position: 'absolute',
						'top': 65,
						'left': (s.x < c.getDimensions().width ) 
							? 0 
							: ((s.x - c.getDimensions().width)/2).round(),
						'z-index': UICONFIG.UIMODALDIALOGZINDEX
			 		});
			 		
			 		$$('body')[0].grab(c);
			 		$('abuse_form').addEvent('submit', function(e1){a(e1)});
			 		$('imagesubmitbutton').addEvent('click', function(e1){a(e1)});
			 		$('code_shadow').focus();
		 		}
		 	}).send();		
		});
	}
});

