  <!--


/***********************************************
* Conveyancing Quote Functions
* 
***********************************************/

				  	    function showSection(section)
						{
							var sections = new Array(4);
								sections[0] = "introduction";
								sections[1] = "sell";
								sections[2] = "buy";
								sections[3] = "remortgage";
				
								
							// Hide all sections
							for (var i = 0; i < sections.length; i++) {
								var section_div = document.getElementById(sections[i]);	
								section_div.className = 'hide';
							}
										
							// Show selected section
							var mySection_div = document.getElementById(section);
							mySection_div.className = 'show';
					  	}
					  	
					  	function popup(file) {
					  		window.open(file,"help","height=400,width=525,menubar=no,location=no,scrollbars=yes,status=no,resize=yes");
						}
		
						// Open New Window to replace target="_blank"
						function targetBlank (url) {
						  blankWin = window.open(url,'_blank','menubar=yes,toolbar=yes,location=yes,directories=yes,fullscreen=no,titlebar=yes,hotkeys=yes,status=yes,scrollbars=yes,resizable=yes');
						}
						
						
						// show/hide table rows
						function toggleRows(field,num) {

							for (var i=0; i<num; i++){
								
						      var row  = document.getElementById(field+i);
						      
						      if (row.className == 'hide')
						      {
							      row.className = 'show_row';
						      }
						      else 
						      {
							      row.className = 'hide';
						      }
					        }
					        if (typeof fixIframe == 'function') {
						        fixIframe();
					        }
						}
						
						// Show Extra Shared Ownership Question
						function toggleShared(prop,val){
						
							var row_id = prop+'_shared_ownership';
							var row = document.getElementById(row_id);
							if (val=="Leasehold"){
								row.className = 'show_row';	
							}	
							else {
								row.className = 'hide';	
							}
						}
						
						function showRows(field,show,hide) {

							// hide all rows
							for (var i=0; i<hide; i++){
						      var rowoff  = document.getElementById(field+i);
						      rowoff.className = 'hide';
					        }
					        
					        // show right rows
					        if (show > 1){
							  for (var x=0; x<show; x++){
						        var rowon   = document.getElementById(field+x);
						        rowon.className = 'show_row';
					          }
				        	}
						}

						// Copy property address to correspondance address
						
						function sameAddress(tick,prop) {
							
							var house1		= document.getElementById('house'+prop); 
							var house   	= document.getElementById('house');
							var road1 	    = document.getElementById('road'+prop); 
							var road   		= document.getElementById('road');
							var town1	    = document.getElementById('town'+prop); 
							var town   		= document.getElementById('town'); 
							var city1	    = document.getElementById('city'+prop); 
							var city   		= document.getElementById('city'); 
							var postcode1   = document.getElementById('postcode'+prop); 
							var postcode	= document.getElementById('postcode'); 
							var email   	= document.getElementById('email'); 
							   
							// copy address	
						    if (tick.checked){
							   
							   house.value 		= house1.value;
							   road.value 		= road1.value;
							   town.value 		= town1.value;
							   city.value 		= city1.value;
							   postcode.value 	= postcode1.value;
							   email.focus();
						    }
						    else {
							    
							   house.value 		= '';
							   road.value 		= '';
							   town.value 		= '';
							   city.value 		= '';
							   postcode.value 	= ''; 
							   house.focus();
						    }
						}
						
						// Increase/Decrease Text size
						var tags 		= new Array('div','td','p','a','h1','h2','h3','ul','ol','li');
						var emArray 	= new Array('0.4','0.5','0.6','0.7','0.8','0.9','1.0','1.1','1.2','1.3','1.4');
						var initSize 	= 4;
						
						function fontSizer(inc) {
							if (!document.getElementById) 
								return;
							var size = initSize;
								size += inc;
							if (size < 0 ) {
								size = 0;
							}
							if (size > 10 ) {
								size = 10;
							}
							initSize = size;
							getBody = document.getElementsByTagName('body')[0];
							getBody.style.fontSize = emArray[size]+"em";
								
							//for (i = 0 ; i < tags.length ; i++ ) {
							  //getallTags = getBody.getElementsByTagName(tags[i]);
							  //for (k = 0 ; k < getallTags.length ; k++) {
							//	getallTags[k].style.fontSize = emArray[size]+"em";
							//  }
							//}
						}
						
						
						
						// Check for valid email address
						function validateEmail(field) 
						{
						    // you could add a test to see if the brower support regular expression or not here 
						    if (RegExp) {
						        return checkEmail(field.value);
						    } else {
						      if (field.value.indexOf("@") == -1 || field.value.indexOf(".") == -1) {
						        return false;
						      } else {
						        return true;
						      }
						   }
						}
						
						function checkEmail(addr)
						{
						    var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,9}(?:\.[a-z]{2})?)$/i
						    return filter.test(addr);
						}

						
						// Check for empty fields
						function isFilled(field) {
						  if (field.value.length < 1 || field.value == null) {
						    return true;
						  } else {
						    return false;
						  }
						}
						
						
						// Find all the mandatory fields
						function getRequired(str) 
						{
							var strLength, fields
							strLength = str.length
							
							if (strLength==0){
								fields = ""
							}
							else{
								fields = str.split(",")
							}
							return fields;
						}
						
						
						// Validate form entries
						// Arguements: form, required fields, field for email validation
						function validateForm(which, sbmit, required, email) {
						
							alert(sbmit.value);
							var vals = getRequired(required.value)
							var n    = vals.length
							var e    = which.length
							var msg  = ""
							
							for(i=0;i<e;++i) {
								var ele = which.elements[i]
								for(x=0;x<n;++x) {
									var nme = vals[x]
									if ((ele.name == nme) && (isFilled(ele))){
										field = ele.name.toUpperCase();
										msg += ("Please provide: "+field+"\n")
									}
								}
							}
							
							//Display Errors
							if (msg != ""){
								alert(msg)
								return false;
							}
							
							//Check Email
							if(email){
								if(!validateEmail(email)){
									msg = ("Sorry, the email address supplied appears to be invalid.\n")
									alert(msg);
									email.focus();
									return false;
								}
							}
							
							return true;
						}
						
						
						// Function to see if different country has been selected
						
						function checkCountry(country) {
							var msg = "";
							
							if (country == "Other"){
								msg = "We are only able to quote for conveyancing within the British Isles."
								alert(msg);
								return false;
							}
							else if (country == "Scotland"){
								msg = "Scottish law is slightly different to English law.\n\nWhen you submit this form, we shall forward your details to our Scottish partners for a valid quote."
								alert(msg);
								return false;
							}
							else if (country == "Ireland"){
								msg = "Irish law is slightly different to English law.\n\nWhen you submit this form, we shall forward you to our Irish partners for a valid quote."
								alert(msg);
								return false;
							}
						}
						


						var rate_0_bedroom = new Object();	//	no bedrooms selected
						rate_0_bedroom[0] = "";
						rate_0_bedroom[1] = "";
						rate_0_bedroom[2] = "";
						rate_0_bedroom[3] = "";
						rate_0_bedroom[4] = "";
						rate_0_bedroom[5] = "";
						rate_0_bedroom[6] = "";
						
						var rate_1_bedroom = new Object();	//	1 bedroom
						rate_1_bedroom[0] = "";
						rate_1_bedroom[1] = "200 - 400";
						rate_1_bedroom[2] = "400 - 600";
						rate_1_bedroom[3] = "400 - 600";
						rate_1_bedroom[4] = "400 - 700";
						rate_1_bedroom[5] = "800 - 1100";
						rate_1_bedroom[6] = "800 - 1100";
						
						var rate_2_bedroom = new Object();	//	2 bedrooms
						rate_2_bedroom[0] = "";
						rate_2_bedroom[1] = "350 - 600";
						rate_2_bedroom[2] = "600 - 750";
						rate_2_bedroom[3] = "700 - 950";
						rate_2_bedroom[4] = "950 - 1200";
						rate_2_bedroom[5] = "1000 - 1350";
						rate_2_bedroom[6] = "1100 - 1500";
						
						var rate_3_bedroom = new Object();	//	3 bedrooms
						rate_3_bedroom[0] = "";
						rate_3_bedroom[1] = "500 - 750";
						rate_3_bedroom[2] = "600 - 900";
						rate_3_bedroom[3] = "750 - 1250";
						rate_3_bedroom[4] = "800 - 1300";
						rate_3_bedroom[5] = "1000 - 1750";
						rate_3_bedroom[6] = "1200 - 2000";
						
						var rate_4_bedroom = new Object();	//	4 bedrooms
						rate_4_bedroom[0] = "";
						rate_4_bedroom[1] = "1000 - 1500";
						rate_4_bedroom[2] = "1100 - 1600";
						rate_4_bedroom[3] = "1200 - 1800";
						rate_4_bedroom[4] = "1200 - 2000";
						rate_4_bedroom[5] = "1400 - 2200";
						rate_4_bedroom[6] = "1500 - 2500";
						
						
						var rate_5_bedroom = new Object();	//	5 bedrooms
						rate_5_bedroom[0] = "";
						rate_5_bedroom[1] = "1200 - 1800";
						rate_5_bedroom[2] = "1200 - 1800";
						rate_5_bedroom[3] = "1400 - 2000";
						rate_5_bedroom[4] = "1500 - 2200";
						rate_5_bedroom[5] = "1600 - 2500";
						rate_5_bedroom[6] = "2000 - 3000";
						
						//	now get menu selections and determine which array value to display
						
						function doUkEstimate(theForm) {
							var bedrooms = theForm.removals_bedrooms.options[theForm.removals_bedrooms.selectedIndex].value;
							var distance = theForm.removals_distance.options[theForm.removals_distance.selectedIndex].value;
							theForm.removals_quote.value = eval("rate_" + bedrooms + "_bedroom[" + distance + "]");
							}
						//-->

