	var scroll;


	window.onload=function(){
		
		scroll = new Fx.Scroll(window);
	}
	
	function a(){}


	function windowScrollDown(){
		
		if( typeof( window.innerWidth ) == 'number' ) {
		    //Non-IE
		    myWidth = window.innerWidth;
		    myHeight = window.innerHeight;
		  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		    //IE 6+ in 'standards compliant mode'
		    myWidth = document.documentElement.clientWidth;
		    myHeight = document.documentElement.clientHeight;
		  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		    //IE 4 compatible
		    myWidth = document.body.clientWidth;
		    myHeight = document.body.clientHeight;
		  }
		
		  scroll.toBottom(); 
	    

	}
	
	
	function windowScrollUp(){
		

		  scroll.toTop(); 
	}
	
	
	


	function onMiniSaleLetSelected(dropdown){
	
		var myindex  = dropdown.selectedIndex;
	    var SelValue = dropdown.options[myindex].value;
	
	

		var a = new Object();
		
		
		if(SelValue == "sale"){
			
			a.onMotionFinished = onMiniSearchFadeOutSaleSelected;
			
		}
		
		if(SelValue == "let"){
			
			a.onMotionFinished = onMiniSearchFadeOutLetSelected;
			
		}
		
		
		opacityTween.addListener(a);
		opacityTween.start();
		
		
	}
	
	function onSaleLetSelected(dropdown){
	
		var myindex  = dropdown.selectedIndex;
	    var SelValue = dropdown.options[myindex].value;
	
	

		var a = new Object();
		
		if(SelValue == "sale"){
			
			a.onMotionFinished = onSearchFadeOutSaleSelected;
			
		}
		
		if(SelValue == "let"){
			
			a.onMotionFinished = onSearchFadeOutLetSelected;
			
		}
		
		
		opacityTween.addListener(a);
		opacityTween.start();
		
		
	}
	
	

	function miniSaleInit(){
		
		
		document.getElementById('mini_search_area').innerHTML = document.getElementById('mini_search_area_sale').innerHTML;
		
	}
	
	function miniLetInit(){
		
		
		document.getElementById('mini_search_area').innerHTML = document.getElementById('mini_search_area_let').innerHTML;
		
	}
	
	
	function saleInit(){
		
		document.getElementById('search_area').innerHTML = document.getElementById('search_area_sale').innerHTML;
		
	}
	
	function letInit(){
		
		
		document.getElementById('search_area').innerHTML = document.getElementById('search_area_let').innerHTML;
		
	}
	
	
	

	function onMiniSearchFadeOutSaleSelected(){
		
		opacityTween.removeListener();
		
		miniSaleInit();
		
		fadeInSearchArea();
		
	}

	function onMiniSearchFadeOutLetSelected(){
		opacityTween.removeListener();
		
		miniLetInit();
	
		fadeInSearchArea();
	}


	function onSearchFadeOutSaleSelected(){
		
		opacityTween.removeListener();
		
		saleInit();
		
		fadeInSearchArea();
		
	}

	function onSearchFadeOutLetSelected(){
		
		opacityTween.removeListener();
		
		letInit();
	
		fadeInSearchArea();
	}


	
	
	
	
	
	
	
	
	
	
	function fadeInSearchArea(){
		opacityTween1.start();
	}

	
	
	function onSaleSearchClick(_dir){
		
		
		var sale_or_let = "sale";
		
		var prop_type = document.getElementById('prop_type').options[document.getElementById('prop_type').selectedIndex].value;
		
		
		var min_price = document.getElementById('min_price').options[document.getElementById('min_price').selectedIndex].value;
		
		var max_price = document.getElementById('max_price').options[document.getElementById('max_price').selectedIndex].value;
		
		
		var min_bedrooms = "any";
		
		var max_bedrooms = "any";
		
		
		
		
		// var areas_str = "";
		// 		var search_areas = "";
		// 		
		// 		if(document.getElementById('area_c') != null){
		// 			if(document.getElementById('area_c').checked){
		// 				search_areas += "c";
		// 			}
		// 		}
		// 		
		// 		if(document.getElementById('area_n') != null){
		// 			if(document.getElementById('area_n').checked){
		// 				search_areas += "n";
		// 			}
		// 		}
		// 		
		// 		if(document.getElementById('area_e') != null){
		// 			if(document.getElementById('area_e').checked){
		// 				search_areas += "e";
		// 			}
		// 		}
		// 		
		// 		if(document.getElementById('area_w') != null){
		// 			if(document.getElementById('area_w').checked){
		// 				search_areas += "w";
		// 			}
		// 		}
		// 		
		// 		if(document.getElementById('area_s') != null){
		// 			if(document.getElementById('area_s').checked){
		// 				search_areas += "s";
		// 			}
		// 		}
		// 		
		// 		if(search_areas != ""){
		// 			
		// 			areas_str = "&area=" + search_areas;
		// 		}
		// 		
		
		setCookies(sale_or_let, prop_type, min_price, max_price, min_bedrooms, max_bedrooms);
		
		window.location.href = _dir + "?" + 
								"trans_type=" + sale_or_let + "&" + 
								"prop_type=" + prop_type + "&" + 
								"min_price=" + min_price + "&" + 
								"max_price=" + max_price + "&" + 
								"min_bedrooms=" + min_bedrooms + "&" + 
								"max_bedrooms=" + max_bedrooms + "&order=price_h"
								
								
								;
		
		
							
		
	}
	
	
	
	function onLetSearchClick(_dir){
		
		
		var sale_or_let = "let";
		
		var prop_type = document.getElementById('prop_type').options[document.getElementById('prop_type').selectedIndex].value;
		
		var frequency = document.getElementById('frequency').options[document.getElementById('frequency').selectedIndex].value;
		
		
		var min_price = document.getElementById('min_price').options[document.getElementById('min_price').selectedIndex].value;
		
		var max_price = document.getElementById('max_price').options[document.getElementById('max_price').selectedIndex].value;
		
		
		var min_bedrooms = "any";
		
		var max_bedrooms = "any";
		
		
		
		
		//var areas_str = "";
		//var search_areas = "";
		
		// if(document.getElementById('area_c') != null){
		// 			if(document.getElementById('area_c').checked){
		// 				search_areas += "c";
		// 			}
		// 		}
		// 		
		// 		if(document.getElementById('area_n') != null){
		// 			if(document.getElementById('area_n').checked){
		// 				search_areas += "n";
		// 			}
		// 		}
		// 		
		// 		if(document.getElementById('area_e') != null){
		// 			if(document.getElementById('area_e').checked){
		// 				search_areas += "e";
		// 			}
		// 		}
		// 		
		// 		if(document.getElementById('area_w') != null){
		// 			if(document.getElementById('area_w').checked){
		// 				search_areas += "w";
		// 			}
		// 		}
		// 		
		// 		if(document.getElementById('area_s') != null){
		// 			if(document.getElementById('area_s').checked){
		// 				search_areas += "s";
		// 			}
		// 		}
		// 		
		// 		
		// 		
		// 		if(search_areas != ""){
		// 			
		// 			areas_str = "&area=" + search_areas;
		// 		}
		// 		
		
		setCookies(sale_or_let, prop_type, min_price, max_price, min_bedrooms, max_bedrooms, frequency);
		
		window.location.href = _dir + "?" + 
								"trans_type=" + sale_or_let + "&" + 
								"prop_type=" + prop_type + "&" + 
								"frequency=" + frequency + "&" + 
								"min_price=" + min_price + "&" + 
								"max_price=" + max_price + "&" + 
								"min_bedrooms=" + min_bedrooms + "&" + 
								"max_bedrooms=" + max_bedrooms + "&order=price_h"
								
								
								;
		
		
	}
	
	
	
	function setCookies(sale_or_let, prop_type, min_price, max_price, min_bedrooms, max_bedrooms, frequency){
		
		
	//	if(document.getElementById('save_selection').checked == true){
			
			
			createCookie("sale_or_let", sale_or_let, 7);
			createCookie("prop_type", prop_type, 7);
			createCookie("min_price", min_price, 7);
			createCookie("max_price", max_price, 7);
			createCookie("min_bedrooms", min_bedrooms, 7);
			createCookie("max_bedrooms", max_bedrooms, 7);
			createCookie("frequency", frequency, 7);
			
			
			
			
			
			
			
						// 
						// 
						// if(document.getElementById('area_c') != null){
						// 	if(document.getElementById('area_c').checked){
						// 		createCookie("area_c", true, 7);
						// 	}else{
						// 		createCookie("area_c", false, 7);
						// 	}
						// }
						// 
						// if(document.getElementById('area_n') != null){
						// 	if(document.getElementById('area_n').checked){
						// 		createCookie("area_n", true, 7);
						// 	}else{
						// 		createCookie("area_n", false, 7);
						// 	}
						// }
						// 
						// if(document.getElementById('area_e') != null){
						// 	if(document.getElementById('area_e').checked){
						// 		createCookie("area_e", true, 7);
						// 	}else{
						// 		createCookie("area_e", false, 7);
						// 	}
						// }
						// 
						// if(document.getElementById('area_w') != null){
						// 	if(document.getElementById('area_w').checked){
						// 		createCookie("area_w", true, 7);
						// 	}else{
						// 		createCookie("area_w", false, 7);
						// 	}
						// }
						// 
						// if(document.getElementById('area_s') != null){
						// 	if(document.getElementById('area_s').checked){
						// 		createCookie("area_s", true, 7);
						// 	}else{
						// 		createCookie("area_s", false, 7);
						// 	}
						// }
						// 
			
	}
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	function setCookiesForEnq(name, address, tel, email, enq){
		
		
		if(document.getElementById('save_selection_enq').checked == true){
			
			var length = 7;
			
			
			
			
			
			createCookie("name", name, exp);
			createCookie("address", address, exp);
			createCookie("tel", tel, exp);
			createCookie("email", email, exp);
			createCookie("enquiry_cookie", enq, exp);

			createCookie("save_selection_enq", document.getElementById('save_selection_enq').checked, exp);
			
			
			
			
			
			
			createCookie("name", name, length);
			createCookie("address", address, length);
			createCookie("tel", tel, length);
			createCookie("email", email, length);
			createCookie("enquiry_cookie", enq, length);
			
			createCookie("save_selection_enq", document.getElementById('save_selection_enq').checked, length);
			
			
			
			
			
			
			
		}else{
			
			var exp = -1;
			
			createCookie("name", name, exp);
			createCookie("address", address, exp);
			createCookie("tel", tel, exp);
			createCookie("email", email, exp);
			createCookie("enquiry_cookie", enq, exp);

			createCookie("save_selection_enq", document.getElementById('save_selection_enq').checked, 7);

			
			
			
			
		}
		
		
		
	}
	
	
	
	
	
	
	
	function moreSearchOptionClick(_sale_or_let){
		
		
		if(_sale_or_let == "sale"){
			
			onSaleSearchClick("sales.php");
			
		}
		
		if(_sale_or_let == "let"){
			
			onLetSearchClick("lettings.php");
			
		}
		
		
	}
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	function createCookie(name,value,days) {
		if (days) {
			var date = new Date();
			date.setTime(date.getTime()+(days*24*60*60*1000));
			var expires = "; expires="+date.toGMTString();
		}
		else var expires = "";
		document.cookie = name+"="+value+expires+"; path=/";
	}

	function readCookie(name) {
		var nameEQ = name + "=";
		var ca = document.cookie.split(';');
		for(var i=0;i < ca.length;i++) {
			var c = ca[i];
			while (c.charAt(0)==' ') c = c.substring(1,c.length);
			if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
		}
		return null;
	}

	function eraseCookie(name) {
		createCookie(name,"",-1);
	}
	
	function openPopUp(_link, _width, _height, _title,  _toolbar){

		var page = _link;
		var width = _width;
		var height = _height;
		
		if(_toolbar == true){
			
			var openWin = window.open(page, '', "toolbar=yes, menubar=yes ,location=yes, scrollbars=yes, resizable=yes, width=" + width + ", height=" + height + ", top=" + (screen.height/2 - height/2) + ", left=" + (screen.width/2 - width/2) + "\""); 
			
		}else{
			var openWin = window.open(page, '', "toolbar=no, menubar=no ,location=no, scrollbars=yes, resizable=yes, width=" + width + ", height=" + height + ", top=" + (screen.height/2 - height/2) + ", left=" + (screen.width/2 - width/2) + "\""); 
			
		}

	//	alert(artistname + " " + itemname);

	}
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	function isValidEmail(strEmail){
	  validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;
	
	   // search email text for regular exp matches
	    if (strEmail.search(validRegExp) == -1) 
	   {
	      return false;
	    } 
	    return true; 
	}
	
	function delayProcess(){
		setTimeout("processEnd()",500);
	}

	function processEnd() {


		if ((xmlhttp.readyState == 4) && (xmlhttp.status == 200)) {





			document.getElementById('preloadArea').innerHTML = '';


			opacityTween = new OpacityTween(document.getElementById('enq_field'),Tween.cubicEaseOut, 100, 0, 0.2);
			opacityTween.start();

			var a = new Object();
			a.onMotionFinished = onFadeOutEnd;

			opacityTween.addListener(a);


		}





	}

	function onFadeOutEnd(){

		document.getElementById('enq_field').innerHTML = document.getElementById('thankyou_field').innerHTML;
		finTween = new OpacityTween(document.getElementById('enq_field'),Tween.cubicEaseOut, 0, 100, 0.2);
		finTween.start();
		
		
		
		var fini = new Object();


		fini.onMotionFinished = fadeOutFini;

		finTween.addListener(fini);




	}

	function fadeOutFini(){


		setTimeout("closeDrawer(0)", 4000);
	}




	function delayProcess_1(){
		setTimeout("processEnd_1()",500);
	}

	function processEnd_1() {


		if ((xmlhttp.readyState == 4) && (xmlhttp.status == 200)) {





			document.getElementById('preloadArea_1').innerHTML = '';


			opacityTween = new OpacityTween(document.getElementById('enq_tofriend_field'),Tween.cubicEaseOut, 100, 0, 0.2);
			opacityTween.start();

			var a = new Object();
			a.onMotionFinished = onFadeOutEnd_1;

			opacityTween.addListener(a);


		}





	}


	function onFadeOutEnd_1(){

		document.getElementById('enq_tofriend_field').innerHTML = document.getElementById('thankyou_field_1').innerHTML;
		finTween = new OpacityTween(document.getElementById('enq_tofriend_field'),Tween.cubicEaseOut, 0, 100, 0.2);
		finTween.start();
		
		var fini = new Object();
		fini.onMotionFinished = fadeOutFini_1;
		finTween.addListener(fini);

	}
	
	function fadeOutFini_1(){
		setTimeout("closeDrawer(1)", 4000);
	}
	
	
	
	// function resetForm(){
	// 
	// 	document.getElementById('thanks_form').innerHTML = '';
	// 	finTween = new OpacityTween(document.getElementById('enq_form'),Tween.cubicEaseOut, 0, 100, 0.1);
	// 	finTween.start();
	// 
	// 	document.getElementById('Name').value = '';
	// 	document.getElementById('Tel').value  = '';
	// 	document.getElementById('Address').value  = '';
	// 	document.getElementById('Email').value  = '';
	// 	document.getElementById('Enquiry').value  = '';
	// 
	// 
	// 
	// 
	// }
	// 
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	function search_result_orderByPrice(dropdown){

	    var myindex2  = dropdown.selectedIndex;
	    var SelValue = dropdown.options[myindex2].value;

	    var baseURL  = currentUrl + '&order=' + SelValue;
	    top.location.href = baseURL;

	    return true;
	}
		
	function search_result_orderBySize(dropdown){

		
		
		var myindex2  = dropdown.selectedIndex;
	    var SelValue = dropdown.options[myindex2].value;



	    var baseURL  = currentUrl + '&order=' + SelValue;
	    top.location.href = baseURL;

	    return true;

	}
	
	
	function search_result_change_frequency(dropdown){
		
		var myindex2  = dropdown.selectedIndex;
	    var SelValue = dropdown.options[myindex2].value;
	
	
	
		var baseURL  = urlWithoutFrequency + 'frequency=' + SelValue;
	    top.location.href = baseURL;

	    return true;
	}
	
	
	
	
	
	
	
	
	SoftScroll.init();
	