// JavaScript Document

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 goClinics(targ,selObj,restore){ //v3.0 
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"&extEvent=getClinics'"); 
if (restore) selObj.selectedIndex=0; 
}

var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, '_blank', '');
}

function validateMember	() {
var oFrm = document.oForm;
var el = document.forms["oForm"].elements;
var radioChecked;

radioChecked = false;

	for(var i = 0 ; i < el.length ; ++i){
		if(el[i].type == "radio"){
		var radiogroup = el[el[i].name]; // get the whole set of radio buttons.
		var itemchecked = false;
			for(var j = 0 ; j < radiogroup.length ; ++j){
				if(radiogroup[j].checked){
				itemchecked = true;
				radioChecked = true;
				break;
				}
			}
		}
	}

haveerrors = 0;
(oFrm.oSurname.value.length < 1)
? showImage("oSurnameError", "../images/misc/fieldError.gif", true)
: showImage("oSurnameError", "../images/misc/fieldBlank.gif", false);

(oFrm.oLastname.value.length < 1)
? showImage("oLastnameError", "../images/misc/fieldError.gif", true)
: showImage("oLastnameError", "../images/misc/fieldBlank.gif", false);

(oFrm.oBirthYear.value.length < 1)
? showImage("oBirthYearError", "../images/misc/fieldError.gif", true)
: showImage("oBirthYearError", "../images/misc/fieldBlank.gif", false);

(oFrm.oGender[0].checked == false && oFrm.oGender[1].checked == false)
? showImage("oGenderError", "../images/misc/fieldError.gif", true)
: showImage("oGenderError", "../images/misc/fieldBlank.gif", false);

(oFrm.oPersonalAddress.value.length < 1)
? showImage("oPersonalAddressError", "../images/misc/fieldError.gif", true)
: showImage("oPersonalAddressError", "../images/misc/fieldBlank.gif", false);

(oFrm.oPersonalPostal.value.length < 1)
? showImage("oPersonalPostalError", "../images/misc/fieldError.gif", true)
: showImage("oPersonalPostalError", "../images/misc/fieldBlank.gif", false);

(oFrm.oPersonalCity.value.length < 1)
? showImage("oPersonalCityError", "../images/misc/fieldError.gif", true)
: showImage("oPersonalCityError", "../images/misc/fieldBlank.gif", false);

(oFrm.oPersonalCountry.value.length < 1)
? showImage("oPersonalCountryError", "../images/misc/fieldError.gif", true)
: showImage("oPersonalCountryError", "../images/misc/fieldBlank.gif", false);

(oFrm.oPersonalPhone.value.length < 1)
? showImage("oPersonalPhoneError", "../images/misc/fieldError.gif", true)
: showImage("oPersonalPhoneError", "../images/misc/fieldBlank.gif", false);

(oFrm.oClinicName.value.length < 1)
? showImage("oClinicNameError", "../images/misc/fieldError.gif", true)
: showImage("oClinicNameError", "../images/misc/fieldBlank.gif", false);

(oFrm.oClinicAddress.value.length < 1)
? showImage("oClinicAddressError", "../images/misc/fieldError.gif", true)
: showImage("oClinicAddressError", "../images/misc/fieldBlank.gif", false);

(oFrm.oClinicPostal.value.length < 1)
? showImage("oClinicPostalError", "../images/misc/fieldError.gif", true)
: showImage("oClinicPostalError", "../images/misc/fieldBlank.gif", false);

(oFrm.oClinicCity.value.length < 1)
? showImage("oClinicCityError", "../images/misc/fieldError.gif", true)
: showImage("oClinicCityError", "../images/misc/fieldBlank.gif", false);

(oFrm.regionId.value.length < 1)
? showImage("regionIdError", "../images/misc/fieldError.gif", true)
: showImage("regionIdError", "../images/misc/fieldBlank.gif", false);

(oFrm.oClinicCountry.value.length < 1)
? showImage("oClinicCountryError", "../images/misc/fieldError.gif", true)
: showImage("oClinicCountryError", "../images/misc/fieldBlank.gif", false);

(oFrm.oClinicPhone.value.length < 1)
? showImage("oClinicPhoneError", "../images/misc/fieldError.gif", true)
: showImage("oClinicPhoneError", "../images/misc/fieldBlank.gif", false);

(oFrm.oClinicMobile.value.length < 1)
? showImage("oClinicMobileError", "../images/misc/fieldError.gif", true)
: showImage("oClinicMobileError", "../images/misc/fieldBlank.gif", false);

(oFrm.oClinicMail.value.length < 1)
? showImage("oClinicMailError", "../images/misc/fieldError.gif", true)
: showImage("oClinicMailError", "../images/misc/fieldBlank.gif", false);

(radioChecked == false)
? showImage("becomeMemberValidationError", "../images/misc/fieldError.gif", true)
: showImage("becomeMemberValidationError", "../images/misc/fieldBlank.gif", false);

return (!haveerrors);
}

function validateMember2() {
var oFrm = document.oForm;
var el = document.forms["oForm"].elements;
var radioChecked;

radioChecked = false;

	for(var i = 0 ; i < el.length ; ++i){
		if(el[i].type == "radio"){
		var radiogroup = el[el[i].name]; // get the whole set of radio buttons.
		var itemchecked = false;
			for(var j = 0 ; j < radiogroup.length ; ++j){
				if(radiogroup[j].checked){
				itemchecked = true;
				radioChecked = true;
				break;
				}
			}
		}
	}

haveerrors = 0;
(oFrm.oSurname.value.length < 1)
? showImage("oSurnameError", "../images/misc/fieldError.gif", true)
: showImage("oSurnameError", "../images/misc/fieldBlank.gif", false);

(oFrm.oLastname.value.length < 1)
? showImage("oLastnameError", "../images/misc/fieldError.gif", true)
: showImage("oLastnameError", "../images/misc/fieldBlank.gif", false);

(oFrm.oBirthYear.value.length < 1)
? showImage("oBirthYearError", "../images/misc/fieldError.gif", true)
: showImage("oBirthYearError", "../images/misc/fieldBlank.gif", false);

(oFrm.oGender[0].checked == false && oFrm.oGender[1].checked == false)
? showImage("oGenderError", "../images/misc/fieldError.gif", true)
: showImage("oGenderError", "../images/misc/fieldBlank.gif", false);

(oFrm.oPersonalAddress.value.length < 1)
? showImage("oPersonalAddressError", "../images/misc/fieldError.gif", true)
: showImage("oPersonalAddressError", "../images/misc/fieldBlank.gif", false);

(oFrm.oPersonalPostal.value.length < 1)
? showImage("oPersonalPostalError", "../images/misc/fieldError.gif", true)
: showImage("oPersonalPostalError", "../images/misc/fieldBlank.gif", false);

(oFrm.oPersonalCity.value.length < 1)
? showImage("oPersonalCityError", "../images/misc/fieldError.gif", true)
: showImage("oPersonalCityError", "../images/misc/fieldBlank.gif", false);

(oFrm.oPersonalCountry.value.length < 1)
? showImage("oPersonalCountryError", "../images/misc/fieldError.gif", true)
: showImage("oPersonalCountryError", "../images/misc/fieldBlank.gif", false);

(oFrm.oPersonalPhone.value.length < 1)
? showImage("oPersonalPhoneError", "../images/misc/fieldError.gif", true)
: showImage("oPersonalPhoneError", "../images/misc/fieldBlank.gif", false);

(oFrm.oClinicMail.value.length < 1)
? showImage("oClinicMailError", "../images/misc/fieldError.gif", true)
: showImage("oClinicMailError", "../images/misc/fieldBlank.gif", false);

(radioChecked == false)
? showImage("becomeMemberValidationError", "../images/misc/fieldError.gif", true)
: showImage("becomeMemberValidationError", "../images/misc/fieldBlank.gif", false);

return (!haveerrors);
}

function validateBooking1() {
var oFrm = document.oForm;
var el = document.forms["oForm"].elements;
var radioChecked;

clinicTypeChecked = false;
bookingTypeChecked = false;
roomTypeChecked = false;

/* Checking clinicType radios */
	for(var i = 0 ; i < el.length ; ++i){
		if(el[i].type == "radio"){
		var radiogroup = el[el[i].name]; // get the whole set of radio buttons.
		var itemchecked = false;
			for(var j = 0 ; j < radiogroup.length ; ++j){
				if(radiogroup[j].checked){
					if(radiogroup[j].name == "clinicType"){
					itemchecked = true;
					clinicTypeChecked = true;
					break;
					}
				}
			}
		}
	}
	
/* Checking oBookingType radios */
	for(var i = 0 ; i < el.length ; ++i){
		if(el[i].type == "radio"){
		var radiogroup = el[el[i].name]; // get the whole set of radio buttons.
		var itemchecked = false;
			for(var j = 0 ; j < radiogroup.length ; ++j){
				if(radiogroup[j].checked){
					if(radiogroup[j].name == "oBookingType"){
					itemchecked = true;
					bookingTypeChecked = true;
					break;
					}
				}
			}
		}
	}

/* Checking oRoomType radios */
	for(var i = 0 ; i < el.length ; ++i){
		if(el[i].type == "radio"){
		var radiogroup = el[el[i].name]; // get the whole set of radio buttons.
		var itemchecked = false;
			for(var j = 0 ; j < radiogroup.length ; ++j){
				if(radiogroup[j].checked){
					if(radiogroup[j].name == "oRoomType"){
					itemchecked = true;
					roomTypeChecked = true;
					break;
					}
				}
			}
		}
	}

haveerrors = 0;
(clinicTypeChecked == false)
? showImage("clinicTypeError", "../images/misc/fieldError.gif", true)
: showImage("clinicTypeError", "../images/misc/fieldBlank.gif", false);

(bookingTypeChecked == false)
? showImage("oBookingTypeError", "../images/misc/fieldError.gif", true)
: showImage("oBookingTypeError", "../images/misc/fieldBlank.gif", false);

(roomTypeChecked == false)
? showImage("oRoomTypeError", "../images/misc/fieldError.gif", true)
: showImage("oRoomTypeError", "../images/misc/fieldBlank.gif", false);

(oFrm.oSurname.value.length < 1)
? showImage("oSurnameError", "../images/misc/fieldError.gif", true)
: showImage("oSurnameError", "../images/misc/fieldBlank.gif", false);

(oFrm.oLastname.value.length < 1)
? showImage("oLastnameError", "../images/misc/fieldError.gif", true)
: showImage("oLastnameError", "../images/misc/fieldBlank.gif", false);

(oFrm.oPosition.value.length < 1)
? showImage("oPositionError", "../images/misc/fieldError.gif", true)
: showImage("oPositionError", "../images/misc/fieldBlank.gif", false);

(oFrm.oClinicName.value.length < 1)
? showImage("oClinicNameError", "../images/misc/fieldError.gif", true)
: showImage("oClinicNameError", "../images/misc/fieldBlank.gif", false);

(oFrm.oPersonalAddress.value.length < 1)
? showImage("oPersonalAddressError", "../images/misc/fieldError.gif", true)
: showImage("oPersonalAddressError", "../images/misc/fieldBlank.gif", false);

(oFrm.oPersonalPostal.value.length < 1)
? showImage("oPersonalPostalError", "../images/misc/fieldError.gif", true)
: showImage("oPersonalPostalError", "../images/misc/fieldBlank.gif", false);

(oFrm.oPersonalCity.value.length < 1)
? showImage("oPersonalCityError", "../images/misc/fieldError.gif", true)
: showImage("oPersonalCityError", "../images/misc/fieldBlank.gif", false);

(oFrm.oPersonalCountry.value.length < 1)
? showImage("oPersonalCountryError", "../images/misc/fieldError.gif", true)
: showImage("oPersonalCountryError", "../images/misc/fieldBlank.gif", false);

(oFrm.oPersonalPhone.value.length < 1)
? showImage("oPersonalPhoneError", "../images/misc/fieldError.gif", true)
: showImage("oPersonalPhoneError", "../images/misc/fieldBlank.gif", false);

(oFrm.oClinicMobile.value.length < 1)
? showImage("oClinicMobileError", "../images/misc/fieldError.gif", true)
: showImage("oClinicMobileError", "../images/misc/fieldBlank.gif", false);

(oFrm.oClinicMail.value.length < 1)
? showImage("oClinicMailError", "../images/misc/fieldError.gif", true)
: showImage("oClinicMailError", "../images/misc/fieldBlank.gif", false);

(oFrm.oArrival.value.length < 1)
? showImage("oArrivalError", "../images/misc/fieldError.gif", true)
: showImage("oArrivalError", "../images/misc/fieldBlank.gif", false);

(oFrm.oDeparture.value.length < 1)
? showImage("oDepartureError", "../images/misc/fieldError.gif", true)
: showImage("oDepartureError", "../images/misc/fieldBlank.gif", false);

return (!haveerrors);
}

function getClinicType(oClinicType,extEvent) {
var oClinicType;
var extEvent;

location.href = "default.asp?clinicType=" + oClinicType + "&extEvent=" + extEvent;
}