<!--

intIEFix = 0;
intAppVersion = 0;
if (navigator.appVersion.indexOf("MSIE")!=-1){
	arrTemp=navigator.appVersion.split("MSIE");
	intAppVersion=parseFloat(arrTemp[1]);
	if((intAppVersion > 0)&&(navigator.userAgent.indexOf("Opera")==-1)){
		intIEFix = 1;
	}
}

function doValidateSearch(objF){
	if(!objF.search.value){
		alert('Please enter your search criteria.');
		objF.search.focus();
		return false;
	}
}

function openWindow(theURL,winName,features, myWidth, myHeight, isCenter){
	if(window.screen)if(isCenter)if(isCenter=="true"){
		var myLeft = (screen.width-myWidth)/2;
		var myTop = (screen.height-myHeight)/2;
		features+=(features!='')?',':'';
		features+=',left='+myLeft+',top='+myTop;
	}
	window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);
}

function preloadImages() {
	var d=document; if(d.images){ if(!d.p) d.p=new Array();
		var i,j=d.p.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)
	if (a[i].indexOf("#")!=0){ d.p[j]=new Image; d.p[j++].src=a[i];}}
}

function showOpenerHTML(){
	var objO = window.parent.opener.document;
	var strKey = '';
	var strType = '';
	var strValue = '';
	var arrRadio = new Array();
	var j = 0;
	document.getElementById('content').innerHTML = objO.getElementById('html_0').innerHTML;
	for(i=0;i<objO.forms.pform.elements.length;i++){
		strKey = objO.forms.pform.elements[i].name;
		strType = objO.forms.pform.elements[i].type;
		strValue = objO.forms.pform.elements[i].value;
		if((strType == 'text')||(strType == 'textarea')){
			eval('document.forms.pform.'+strKey).value=strValue;
		}
		else if(strType == 'radio'){
			if(objO.forms.pform.elements[i].checked == true){
				arrRadio[j] = strKey;
				j++;
			}
		}
	}
	for (i=0;i<arrRadio.length;i++){
		objR = eval('objO.forms.pform.'+arrRadio[i]);
		for(j=0;j<objR.length;j++){
			if(objR[j].checked == true){
				eval('document.forms.pform.'+arrRadio[i]+'['+j+']').checked=true;
			}
		}
	}
	
}

function doValidateMailing(objF){
	if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(objF.email.value)){
		alert('Please enter a valid email address.');
		objF.email.focus();
		return false;
	}
	var intC=0;
	for(i=0;i<objF.elements.length;i++){
		if(objF.elements[i].checked){
			intC++;
		}
	}
	if (intC <= 0){
		alert('Please choose a mailing list to subscribe to.');
		return false;
	}
}

function doValidateUnsubscribe(objF){
	if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(objF.email.value)){
		alert('Please enter a valid email address.');
		objF.email.focus();
		return false;
	}
}

function doValidateCallback(objF){
	if(!objF.first_name.value){
		alert('Please enter your first name.');
		objF.first_name.focus();
		return false;
	}
	if(!objF.phone_number.value){
		alert('Please enter your telephone number.');
		objF.phone_number.focus();
		return false;
	}
	var intC=0;
	for(i=0;i<objF.elements.length;i++){
		if((objF.elements[i].type=='checkbox')&&(objF.elements[i].checked)){
			intC++;
		}
	}
	if (intC <= 0){
		alert('Please select a convenient callback time.');
		return false;
	}
}

function doValidateBooking(objF){
	if(objF.temp_val.value == 0){
		return true;
	}
	if(typeof(objF.step_4) != 'undefined'){
		if(!objF.pre_existing_medical_condition[0].checked){
			if(!objF.pre_existing_medical_condition[1].checked){
				alert('Please specify if you have a pre-existing medical condition.');
				objF.pre_existing_medical_condition[0].focus();
				return false;
			}
		}
		if(objF.pre_existing_medical_condition[0].checked){
			var intC = 0;
			for(i=0;i<objF.elements.length;i++){
				if((objF.elements[i].type == 'checkbox')&&(objF.elements[i].checked)){
					intC++;
				}
			}
			if((intC == 0)&&(!objF.further_medical_information.value)){
				alert('Please specify your medical condition(s).');
				return false;
			}
		}
	}
	
	if(typeof(objF.step_2) != 'undefined'){
		if(!objF.first_name.value){
			alert('Please enter your first name.');
			objF.first_name.focus();
			return false;
		}
		if(!objF.last_name.value){
			alert('Please enter your last name.');
			objF.last_name.focus();
			return false;
		}
		if(!objF.phone_number.value){
			alert('Please enter a contact telephone number.');
			objF.phone_number.focus();
			return false;
		}
		if((!objF.date_of_birth_day.value)||(!objF.date_of_birth_month.value)||(!objF.date_of_birth_year.value)){
			alert('Please enter your date of birth in full.');
			objF.date_of_birth_day.focus();
			return false;
		}
		if(typeof(objF.first_day_of_last_period) != 'undefined'){
			if((!objF.first_day_of_last_period.value)||(!objF.month_of_last_period.value)){
				alert('Please select the first day of your last period.');
				objF.first_day_of_last_period.focus();
				return false;
			}
		}
		if(!objF.home_house_number.value){
			alert('Please enter your house number/name (home).');
			objF.home_house_number.focus();
			return false;
		}
		if(!objF.home_street.value){
			alert('Please enter your street name (home).');
			objF.home_street.focus();
			return false;
		}
		if(!objF.home_postcode.value){
			alert('Please enter your postcode (home).');
			objF.home_postcode.focus();
			return false;
		}
		if(!objF.home_city.value){
			alert('Please enter your city name (home).');
			objF.home_city.focus();
			return false;
		}
		if(!objF.home_country.value){
			alert('Please enter your country name (home).');
			objF.home_country.focus();
			return false;
		}
		if(!objF.contact_phone.value){
			alert('Please enter a contact telephone number (home).');
			objF.contact_phone.focus();
			return false;
		}
		if((objF.receive_confirmation_by[1].checked)||(objF.preferred_contact_method[2].checked)){
			if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(objF.contact_email.value)){
				alert('Please enter a valid contact email address.');
				objF.contact_email.focus();
				return false;
			}
		}
		if(!objF.receive_confirmation_by[0].checked){
			if(!objF.receive_confirmation_by[1].checked){
				alert('Please select how you would like to receive confirmation of your appointment.');
				objF.receive_confirmation_by[0].focus();
				return false;
			}
		}
		if(!objF.send_to_home_address[0].checked){
			if(!objF.send_to_home_address[1].checked){
				alert('Please select whether we should use your home address.');
				objF.send_to_home_address[0].focus();
				return false;
			}
		}
		if(objF.send_to_home_address[1].checked){
			if(!objF.correspondence_house_number.value){
				alert('Please enter your house number/name (correspondence).');
				objF.correspondence_house_number.focus();
				return false;
			}
			if(!objF.correspondence_street.value){
				alert('Please enter your street name (correspondence).');
				objF.correspondence_street.focus();
				return false;
			}
			if(!objF.correspondence_postcode.value){
				alert('Please enter your postcode (correspondence).');
				objF.correspondence_postcode.focus();
				return false;
			}
			if(!objF.correspondence_city.value){
				alert('Please enter your city name (correspondence).');
				objF.correspondence_city.focus();
				return false;
			}
			if(!objF.correspondence_country.value){
				alert('Please enter your country name (correspondence).');
				objF.correspondence_country.focus();
				return false;
			}
			
		}
		if(!objF.preferred_contact_method[0].checked){
			if(!objF.preferred_contact_method[1].checked){
				if(!objF.preferred_contact_method[2].checked){
					alert('Please select your preferred contact method.');
					objF.preferred_contact_method[0].focus();
					return false;
				}
			}
		}
	}
	
	
	
}

function showHideAddress2(intType){
	objF = document.bform;
	if(intType == 1){
		boolCheck = true;
	}
	else{
		boolCheck = false;
	}
	objF.correspondence_house_number.disabled = boolCheck;
	objF.correspondence_street.disabled = boolCheck;
	objF.correspondence_postcode.disabled = boolCheck;
	objF.correspondence_city.disabled = boolCheck
	objF.correspondence_country.disabled = boolCheck;
	
}

function showHideConditions(intType){
	objF = document.bform;
	if(intType == 2){
		boolCheck = true;
	}
	else{
		boolCheck = false;
	}
	for(i=0;i<objF.elements.length;i++){
		if(objF.elements[i].type == 'checkbox'){
			objF.elements[i].disabled = boolCheck;
		}
	}
}

function showClinicInfo(){
	objF = document.bform;
	arrField = new Array();
	arrField[0] = "first_choice_clinic";
	arrField[1] = "second_choice_clinic";
	arrField[2] = "third_choice_clinic";
	for(i=0;i<arrField.length;i++){
		objTemp = eval('objF.'+arrField[i]);
		if(objTemp[objTemp.selectedIndex].value != ''){
			arrTemp = objTemp[objTemp.selectedIndex].value.split('||')
			strTemp = ' &nbsp; <a href="clinics.php?clinic='+arrTemp[1]+'" target="blank">Information</a>';
			document.getElementById('clinic_'+i).innerHTML = strTemp;
		}
		else{
			document.getElementById('clinic_'+i).innerHTML = ''
		}
	}
}

function add_uk_sufix(){
   	document.getElementById('city').value = (document.getElementById('city').value.replace(" uk","") + " uk");
	return check_address_form();
}
-->
