window.addEvent('domready', function(){

	//HIDE LOGIN AREA
	$$('fieldset.login')[0].setStyle('display','none');
	
	//WRITE COOKIE
	Cookie.write('chk', 'true', {duration: false});
	
	//READ COOKIE
	if (Cookie.read('chk') != null) {
		// REMOVE COOKIE MESSAGE
		$$('div[class^=chk]')[0].destroy();
		//SHOW LOGIN AREA
		$$('fieldset.login')[0].setStyle('display','block');
	} else {
		$$('div.chkRequirementsMessage').setStyle('display','block');
		alert('Please enable cookies in your Web Browser.\n\nYou may find instructions for your browser in the red box on the page.');
	}
	
	//CLICK EVENT FOR EMAIL PASSWORD
	var reminderLnk = $('reminderLink');
	reminderLnk.addEvent('click',function(event) {
		if($chk(event)) {
			event.stop();
		}
		$$('fieldset.login legend')[0].set('text', 'Send Reminder');
		$$('label[for^=password]')[0].destroy();
		var showHidePassword = $('password').getParent('div[class^=showHidePassword]');
		if($chk(showHidePassword)) {
			showHidePassword.destroy();
		} else {
			$('password').destroy();
		}
		$('reminder').set('value','1');
		$('submit').set('value','send reminder');
		this.setStyle('display','none');
		$('email').focus();
	});
	
	//CHECK IF REMINDER WAS SENT
	if($('reminder').value == "1") {
		reminderLnk.fireEvent('click');
	}
	
});