function windowInit() {
	combox = document.getElementById('commentbox');
	if (combox) { 
		writeCommentBox();
		combox.onclick = clearCommentBox;
		combox.onblur = writeCommentBox;
	}

	username = document.getElementById('login-email');
	if (username) {
		username.onclick = clearUser;
		username.onblur = writeUser;
	}

	password = document.getElementById('login-password');
	if (password) {
		if (!/msie/i.test(navigator.userAgent)) {
			password.type = 'text';
		}
		password.onclick = clearPass;
		password.onfocus = clearPass;
		password.onblur = writePass;
	}

}

function writeCommentBox() {
	combox = document.getElementById('commentbox');
	if (combox.value.replace(/\s{0,}$/, '') == '') {
		combox.value = 'Comment on this';
	}
}

function clearCommentBox() {
	combox = document.getElementById('commentbox');
	combox.value = combox.value.replace(/Comment on this/, '');
}

function clearUser() {
	forminput = document.getElementById('login-email');
	forminput.value = forminput.value.replace(/email address/, '');
}

function writeUser() {
	forminput = document.getElementById('login-email');
	if (forminput.value.replace(/\s{0,}$/, '') == '') {
		forminput.value = forminput.value = 'email address';
	}
}

function clearPass() {
	passinput = document.getElementById('login-password');
	passinput.value = passinput.value.replace(/^password$/, '');
	if (!/msie/i.test(navigator.userAgent)) {
		passinput.type = 'password';
	}
}

function writePass() {
	passinput = document.getElementById('login-password');
	if (passinput.value.replace(/^\s{0,}$/, '') == '') {
		passinput.value = 'password';
		if (!/msie/i.test(navigator.userAgent)) {
			passinput.type = 'text';
		}
	}
}

window.onload = windowInit;