// JavaScript Document

function emptyField(fld) {
var oField = fld; 
oField.value = "";
}

function emptyPasswordField(fld) {
var oField = fld;
oField.type = "";
oField.value = "";
}

var switcher = 0;
function emptyPasswordField_2() {
var textfield = document.forms['forumLoginForm'].elements['textField'];
var passfield = document.forms['forumLoginForm'].elements['passField'];

	if(switcher == 0) {
	textfield.value = ""
	textfield.style.display = "none"
	passfield.value = textfield.value
	passfield.style.display = "block"
	switcher++
	}
	else{
	textfield.style.display = "block"
	textfield.value = passfield.value
	passfield.style.display = "none"
	switcher--
	}
}

var empty = new Image(); empty.src = "images/misc/fieldError.gif";
var haveerrors = 0;

function showImage(imagename, imageurl, errors) {
document[imagename].src = imageurl;
if (!haveerrors && errors) haveerrors = errors;
}

function validateGB() {
var oForm = document.oForm;

haveerrors = 0;
(oForm.fullName.value.length < 1)
? showImage("fullNameError", "images/misc/fieldError.gif", true)
: showImage("fullNameError", "images/misc/fieldBlank.gif", false);

(oForm.memoText.innerText.length < 1)
? showImage("memoTextError", "images/misc/fieldError.gif", true)
: showImage("memoTextError", "images/misc/fieldBlank.gif", false);

(oForm.verificationCode.value.length < 1)
? showImage("verificationCodeError", "http://www.zaragonrockclub.se/images/misc/fieldError.gif", true)
: showImage("verificationCodeError", "http://www.zaragonrockclub.se/images/misc/fieldBlank.gif", false);

return (!haveerrors);
}

function validateMemberForm() {
var oForm = document.registrationForm;

haveerrors = 0;
(oForm.oSurname.value.length < 1)
? showImage("oSurnameError", "images/misc/fieldError.gif", true)
: showImage("oSurnameError", "images/misc/fieldBlank.gif", false);

(oForm.oLastname.value.length < 1)
? showImage("oLastnameError", "images/misc/fieldError.gif", true)
: showImage("oLastnameError", "images/misc/fieldBlank.gif", false);

(oForm.orgNumber.value.length < 8)
? showImage("orgNumberError", "http://www.zaragonrockclub.se/images/misc/fieldError.gif", true)
: showImage("orgNumberError", "http://www.zaragonrockclub.se/images/misc/fieldBlank.gif", false);

(oForm.oEmail.value.length < 1)
? showImage("oEmailError", "http://www.zaragonrockclub.se/images/misc/fieldError.gif", true)
: showImage("oEmailError", "http://www.zaragonrockclub.se/images/misc/fieldBlank.gif", false);

(!oForm.oConditions.checked)
? showImage("oConditionsError", "http://www.zaragonrockclub.se/images/misc/fieldError.gif", true)
: showImage("oConditionsError", "http://www.zaragonrockclub.se/images/misc/fieldBlank.gif", false);

return (!haveerrors);
}