function MM_findObj(n, d) { // v4.01
	var p, i, x;
	if (!d) {
		d = document;
	}
	if ((p = n.indexOf("?")) > 0 && parent.frames.length) {
		d = parent.frames[n.substring(p + 1)].document;
		n = n.substring(0, p);
	}
	if (!(x = d[n]) && d.all) {
		x = d.all[n];
	}
	for (i = 0; !x && i < d.forms.length; i++) {
		x = d.forms[i][n];
	}
	for (i = 0; !x && d.layers && i < d.layers.length; i++) {
		x = MM_findObj(n, d.layers[i].document);
	}
	if (!x && d.getElementById) {
		x = d.getElementById(n);
	}
	return x;
}
function MM_preloadImages() { // v3.0	
	var d = document;
	if (d.images) {
		if (!d.MM_p) {
			d.MM_p = new Array();
		}
		var i, j = d.MM_p.length, a = MM_preloadImages.arguments;
		for (i = 0; i < a.length; i++) {
			if (a[i].indexOf("#") != 0) {
				d.MM_p[j] = new Image;
				d.MM_p[j++].src = a[i];
			}
		}
	}
}
function MM_swapImgRestore() { // v3.0
	var i, x, a = document.MM_sr;
	if (a != null) {
		var tmp = a[0];
		if (tmp.id == "Image48" && globalCenter == "true") {
			//do nothing
		} else if (tmp.id == "Image49" && globalSleep == "true") {
			//do nothing
		} else if (tmp.id == "Image41" && globalOneRoom == "true") {
			//do nothing
		} else if (tmp.id == "Image42" && globalTwoRooms == "true") {
			//do nothing
		} else if (tmp.id == "Image43" && globalThreeRooms == "true") {
			//do nothing
		} else if (tmp.id == "Image44" && globalFourRooms == "true") {
			//do nothing
		} else if (tmp.id == "Image45" && globalLowPrice == "true") {
			//do nothing
		} else if (tmp.id == "Image46" && globalMediumPrice == "true") {
			//do nothing
		} else if (tmp.id == "Image47" && globalHighPrice == "true") {
			//do nothing
		} else for (i = 0; a && i < a.length && (x = a[i]) && x.oSrc; i++) {
			x.src = x.oSrc;
		}
	}
}
function MM_swapImage() { // v3.0
	var i, j = 0, x, a = MM_swapImage.arguments;	
	if (a[0] == "Image48" && globalCenter == "true") {
		//do nothing (avoid onmousout and onmouseover events)
	} else if (a[0] == "Image49" && globalSleep == "true") { 
		//do nothing (avoid onmousout and onmouseover events)
	} else if (a[0] == "Image41" && globalOneRoom == "true") { 
		//do nothing (avoid onmousout and onmouseover events)
	} else if (a[0] == "Image42" && globalTwoRooms == "true") { 
		//do nothing (avoid onmousout and onmouseover events)
	} else if (a[0] == "Image43" && globalThreeRooms == "true") { 
		//do nothing (avoid onmousout and onmouseover events)
	} else if (a[0] == "Image44" && globalFourRooms == "true") { 
		//do nothing (avoid onmousout and onmouseover events)
	} else if (a[0] == "Image45" && globalLowPrice == "true") { 
		//do nothing (avoid onmousout and onmouseover events)
	} else if (a[0] == "Image46" && globalMediumPrice == "true") { 
		//do nothing (avoid onmousout and onmouseover events)
	} else if (a[0] == "Image47" && globalHighPrice == "true") { 
		//do nothing (avoid onmousout and onmouseover events)
	} else {
		document.MM_sr = new Array;
		for (i = 0; i < (a.length - 2); i += 3) {
			if ((x = MM_findObj(a[i])) != null) {
				document.MM_sr[j++] = x;
				x.oSrc = x.src;
				x.src = a[i + 2];
			}
		}
	}
}

function clickOnCenter() {
	var centerHidden = document.getElementById("centerHidden");
	var centerImg = document.getElementById("Image48");
	if (globalCenter == "true") {
		globalCenter = "false";
		centerHidden.value = "false";
		centerImg.src = "img/districtCenter.gif";		
	} else {
		globalCenter = "true";
		centerHidden.value = "true";
		centerImg.src = "img/districtCenterPressed.gif";		
	}
}

function clickOnSleep() {
	var sleepHidden = document.getElementById("sleepHidden");
	var sleepImg = document.getElementById("Image49");
	if (globalSleep == "true") {
		globalSleep = "false";
		sleepHidden.value = "false";
		if (globalCurrentLanguage == "ru") {
			sleepImg.src = "img/districtSleepDefault_RU.gif";
		} else {
			sleepImg.src = "img/districtSleepDefault.gif";
		}
	} else {
		globalSleep = "true";
		sleepHidden.value = "true";
		if (globalCurrentLanguage == "ru") {
			sleepImg.src = "img/districtSleepDefaultPressed_RU.gif";
		} else {
			sleepImg.src = "img/districtSleepDefaultPressed.gif";
		}
	}
}

function clickOnRoomQuantity1() {
	var oneRoomHidden = document.getElementById("oneRoomHidden");
	var oneRoomImg = document.getElementById("Image41");
	if (globalOneRoom == "true") {
		globalOneRoom = "false";
		oneRoomHidden.value = "false";
		oneRoomImg.src = "img/roomQuantity1.gif";		
	} else {
		globalOneRoom = "true";
		oneRoomHidden.value = "true";
		oneRoomImg.src = "img/roomQuantity1_pressed.gif";		
	}
}

function clickOnRoomQuantity2() {
	var twoRoomsHidden = document.getElementById("twoRoomsHidden");
	var twoRoomsImg = document.getElementById("Image42");
	if (globalTwoRooms == "true") {
		globalTwoRooms = "false";
		twoRoomsHidden.value = "false";
		twoRoomsImg.src = "img/roomQuantity2.gif";		
	} else {
		globalTwoRooms = "true";
		twoRoomsHidden.value = "true";
		twoRoomsImg.src = "img/roomQuantity2_pressed.gif";		
	}
}

function clickOnRoomQuantity3() {
	var threeRoomsHidden = document.getElementById("threeRoomsHidden");
	var threeRoomsImg = document.getElementById("Image43");
	if (globalThreeRooms == "true") {
		globalThreeRooms = "false";
		threeRoomsHidden.value = "false";
		threeRoomsImg.src = "img/roomQuantity3.gif";		
	} else {
		globalThreeRooms = "true";
		threeRoomsHidden.value = "true";
		threeRoomsImg.src = "img/roomQuantity3_pressed.gif";		
	}
}

function clickOnRoomQuantity4() {
	var fourRoomsHidden = document.getElementById("fourRoomsHidden");
	var fourRoomsImg = document.getElementById("Image44");
	if (globalFourRooms == "true") {
		globalFourRooms = "false";
		fourRoomsHidden.value = "false";
		fourRoomsImg.src = "img/roomQuantity4.gif";		
	} else {
		globalFourRooms = "true";
		fourRoomsHidden.value = "true";
		fourRoomsImg.src = "img/roomQuantity4_pressed.gif";		
	}
}

function clickOnLowPrice() {
	var lowPriceHidden = document.getElementById("lowPriceHidden");
	var lowPriceImg = document.getElementById("Image45");	
	if (globalLowPrice == "true") {
		globalLowPrice = "false";
		lowPriceHidden.value = "false";
		lowPriceImg.src = "img/priceLess200.gif";	
	} else {
		globalLowPrice = "true";
		lowPriceHidden.value = "true";
		lowPriceImg.src = "img/priceLess200_pressed.gif";		
	}
}

function clickOnMediumPrice() {
	var mediumPriceHidden = document.getElementById("mediumPriceHidden");
	var mediumPriceImg = document.getElementById("Image46");	
	if (globalMediumPrice == "true") {
		globalMediumPrice = "false";
		mediumPriceHidden.value = "false";
		mediumPriceImg.src = "img/priceRange200-400.gif";	
	} else {
		globalMediumPrice = "true";
		mediumPriceHidden.value = "true";
		mediumPriceImg.src = "img/priceRange200-400_pressed.gif";		
	}
}

function clickOnHighPrice() {
	var highPriceHidden = document.getElementById("highPriceHidden");
	var highPriceImg = document.getElementById("Image47");	
	if (globalHighPrice == "true") {
		globalHighPrice = "false";
		highPriceHidden.value = "false";
		if (globalCurrentLanguage == "ru") {
			highPriceImg.src = "img/priceOver400_RU.gif";
		} else {
			highPriceImg.src = "img/priceOver400.gif";
		}
	} else {
		globalHighPrice = "true";
		highPriceHidden.value = "true";
		if (globalCurrentLanguage == "ru") {
			highPriceImg.src = "img/priceOver400_pressed_RU.gif";
		} else {
			highPriceImg.src = "img/priceOver400_pressed.gif";
		}
	}
}

function updateFilterImeges(){
	var centerImg = document.getElementById("Image48");
	var sleepImg = document.getElementById("Image49");
	var oneRoomImg = document.getElementById("Image41");
	var twoRoomsImg = document.getElementById("Image42");
	var threeRoomsImg = document.getElementById("Image43");
	var fourRoomsImg = document.getElementById("Image44");
	var lowPriceImg = document.getElementById("Image45");
	var mediumPriceImg = document.getElementById("Image46");
	var highPriceImg = document.getElementById("Image47");
	var searchDiv = document.getElementById("submitHolder");
	if (globalCurrentLanguage == "uk") {
		$(searchDiv).attr('id', 'submitHolder');
	} else if (globalCurrentLanguage == "ru") {
		$(searchDiv).attr('id', 'submitHolder_RU');
	}
	if (globalCenter == "true"){
		centerImg.src = "img/districtCenterPressed.gif";
	} else {
		centerImg.src = "img/districtCenter.gif";
	}
	if (globalSleep == "true") {
		if (globalCurrentLanguage == "ru") {
			sleepImg.src = "img/districtSleepDefaultPressed_RU.gif";
		} else {
			sleepImg.src = "img/districtSleepDefaultPressed.gif";
		}
	} else {
		if (globalCurrentLanguage == "ru") {
			sleepImg.src = "img/districtSleepDefault_RU.gif";
		} else {
			sleepImg.src = "img/districtSleepDefault.gif";
		}
	}
	if (globalOneRoom == "true") {
		oneRoomImg.src = "img/roomQuantity1_pressed.gif";
	} else {
		oneRoomImg.src = "img/roomQuantity1.gif";
	}
	if (globalTwoRooms == "true") {
		twoRoomsImg.src = "img/roomQuantity2_pressed.gif";
	} else {
		twoRoomsImg.src = "img/roomQuantity2.gif";
	}
	if (globalThreeRooms == "true") {
		threeRoomsImg.src = "img/roomQuantity3_pressed.gif";
	} else {
		threeRoomsImg.src = "img/roomQuantity3.gif";
	}
	if (globalFourRooms == "true") {
		fourRoomsImg.src = "img/roomQuantity4_pressed.gif";
	} else {
		fourRoomsImg.src = "img/roomQuantity4.gif";
	}
	if (globalLowPrice == "true") {
		lowPriceImg.src = "img/priceLess200_pressed.gif";
	} else {
		lowPriceImg.src = "img/priceLess200.gif";
	}
	if (globalMediumPrice == "true") {
		mediumPriceImg.src = "img/priceRange200-400_pressed.gif";
	} else {
		mediumPriceImg.src = "img/priceRange200-400.gif";
	}
	if (globalHighPrice == "true") {
		if (globalCurrentLanguage == "ru") {
			highPriceImg.src = "img/priceOver400_pressed_RU.gif";
		} else {
			highPriceImg.src = "img/priceOver400_pressed.gif";
		}
	} else {
		if (globalCurrentLanguage == "ru") {
			highPriceImg.src = "img/priceOver400_RU.gif";
		} else {
			highPriceImg.src = "img/priceOver400.gif";
		}
	}
}


