function showEnquiry(theId, theLang) {
	w_width = 500;
	w_height = 600;
	if (screen) {
		w_left = (screen.availWidth - w_width)/2;
		w_top = ((screen.availHeight - w_height)/2)-20;
	}
	theWindowParam = 'width='+w_width+',height='+w_height+',left='+w_left+',top='+w_top+',status=no,resizable=yes,scrollbars=yes';

	fparam = 'templates/ws_mm_estates_10/showenquiry.php?pageid=' + theId + '&lang=' + theLang;
  window.showEnquiryWindow = open(fparam, 'showEnquiryWindow', theWindowParam);
	setTimeout('if(showEnquiryWindow&&!showEnquiryWindow.closed)showEnquiryWindow.focus()',100);
}
function showSpecifications(theId, theLang) {
	w_width = 500;
	w_height = 550;
	if (screen) {
		w_left = (screen.availWidth - w_width)/2;
		w_top = ((screen.availHeight - w_height)/2)-20;
	}
	theWindowParam = 'width='+w_width+',height='+w_height+',left='+w_left+',top='+w_top+',status=no,resizable=yes,scrollbars=yes';

	fparam = 'templates/ws_mm_estates_10/showspecs.php?pageid=' + theId + '&lang=' + theLang;
  window.showSpecificationsWindow = open(fparam, 'showSpecificationsWindow', theWindowParam);
	setTimeout('if(showSpecificationsWindow&&!showSpecificationsWindow.closed)showSpecificationsWindow.focus()',100);
}
function photoGallery(theId, theLang) {
	w_width = 850;
	w_height = 620;
	if (screen) {
		w_left = (screen.availWidth - w_width)/2;
		w_top = ((screen.availHeight - w_height)/2)-20;
	}
	theWindowParam = 'width='+w_width+',height='+w_height+',left='+w_left+',top='+w_top+',status=no,resizable=yes,scrollbars=yes';

	fparam = 'templates/ws_mm_estates_10/showphotogallery.php?pageid=' + theId + '&lang=' + theLang;
  window.photoGalleryWindow = open(fparam, 'photoGalleryWindow', theWindowParam);
	setTimeout('if(photoGalleryWindow&&!photoGalleryWindow.closed)photoGalleryWindow.focus()',100);
}
function planGallery(theId, theLang) {
	w_width = 850;
	w_height = 620;
	if (screen) {
		w_left = (screen.availWidth - w_width)/2;
		w_top = ((screen.availHeight - w_height)/2)-20;
	}
	theWindowParam = 'width='+w_width+',height='+w_height+',left='+w_left+',top='+w_top+',status=no,resizable=yes,scrollbars=yes';

	fparam = 'templates/ws_mm_estates_10/showplangallery.php?pageid=' + theId + '&lang=' + theLang;
  window.planGalleryWindow = open(fparam, 'planGalleryWindow', theWindowParam);
	setTimeout('if(planGalleryWindow&&!planGalleryWindow.closed)planGalleryWindow.focus()',100);
}
function videoGallery(theId, theLang) {
	w_width = 850;
	w_height = 620;
	if (screen) {
		w_left = (screen.availWidth - w_width)/2;
		w_top = ((screen.availHeight - w_height)/2)-20;
	}
	theWindowParam = 'width='+w_width+',height='+w_height+',left='+w_left+',top='+w_top+',status=no,resizable=yes,scrollbars=yes';

	fparam = 'templates/ws_mm_estates_10/showvideogallery.php?pageid=' + theId + '&lang=' + theLang;
  window.videoGalleryWindow = open(fparam, 'videoGalleryWindow', theWindowParam);
	setTimeout('if(videoGalleryWindow&&!videoGalleryWindow.closed)videoGalleryWindow.focus()',100);
}
function showVideo(theId, theLang, theVideoId) {
	w_width = 850;
	w_height = 620;
	if (screen) {
		w_left = (screen.availWidth - w_width)/2;
		w_top = ((screen.availHeight - w_height)/2)-20;
	}
	theWindowParam = 'width='+w_width+',height='+w_height+',left='+w_left+',top='+w_top+',status=no,resizable=yes,scrollbars=yes';

	fparam = 'templates/ws_mm_estates_10/showvideo.php?pageid=' + theId + '&lang=' + theLang + '&videoid=' + theVideoId;
  window.showVideoWindow = open(fparam, 'showVideoWindow', theWindowParam);
	setTimeout('if(showVideoWindow&&!showVideoWindow.closed)showVideoWindow.focus()',100);
}
function showLocationPhoto(theId, theLang) {
	w_width = 850;
	w_height = 620;
	if (screen) {
		w_left = (screen.availWidth - w_width)/2;
		w_top = ((screen.availHeight - w_height)/2)-20;
	}
	theWindowParam = 'width='+w_width+',height='+w_height+',left='+w_left+',top='+w_top+',status=no,resizable=yes,scrollbars=yes';

	fparam = 'templates/ws_mm_estates_10/showlocationphoto.php?pageid=' + theId + '&lang=' + theLang;
  window.showLocationPhotoWindow = open(fparam, 'showLocationPhotoWindow', theWindowParam);
	setTimeout('if(showLocationPhotoWindow&&!showLocationPhotoWindow.closed)showLocationPhotoWindow.focus()',100);
}
function goToFindProperty(theform,thePageId) {
  var theLoc = theform.criteria_location.value;
  var theType = theform.criteria_type.value;
  var theMinPrice = theform.criteria_minprice.value;
  var theMaxPrice = theform.criteria_maxprice.value;
  var theRef = theform.criteria_referenceno.value;
	
  lochref = 'index.php?pageid='+thePageId+'&filter=Search&criteria=set';

	if (theLoc != '') {	lochref += '&loc=' + theLoc; }
	if (theType != '') {	lochref += '&type=' + theType; }
	if (theMinPrice != '') {	lochref += '&minprice=' + theMinPrice; }
	if (theMaxPrice != '') {	lochref += '&maxprice=' + theMaxPrice; }
	if (theRef != '') {	lochref += '&ref=' + theRef; }

	//alert("The values are: "+theLoc+" "+theType+" "+theMinPrice+" "+theMaxPrice+" "+theRef+"The url is: "+lochref);
	location = lochref;
}
function enquireforproperty(thePageId, theLang) {
	alert(thePageId+theLang);
	
  lochref = 'index.php?pageid='+thePageId+'&filter=Search&criteria=set';
	
	//alert("The values are: "+theLoc+" "+theType+" "+theMinPrice+" "+theMaxPrice+" "+theRef+"The url is: "+lochref);
	location = lochref;
}

function showPhoto(theId, theLang, thePhotoNum) {
	w_width = 685;
	w_height = 630;
	if (screen) {
		w_left = (screen.availWidth - w_width)/2;
		w_top = ((screen.availHeight - w_height)/2)-20;
	}
	theWindowParam = 'width='+w_width+',height='+w_height+',left='+w_left+',top='+w_top+',status=no,resizable=no,scrollbars=yes';

	fparam = 'templates/ws_mm_estates_10/showphoto.php?pageid=' + theId + '&lang=' + theLang + '&photonum=' + thePhotoNum;
  window.showPhotoWindow = open(fparam, 'showPhotoWindow', theWindowParam);
	setTimeout('if(showPhotoWindow&&!showPhotoWindow.closed)showPhotoWindow.focus()',100);
}

function showDetais(theId, theLang) {
	w_width = 685;
	w_height = 700;
	if (screen) {
		w_left = (screen.availWidth - w_width)/2;
		w_top = ((screen.availHeight - w_height)/2)-20;
	}
	theWindowParam = 'width='+w_width+',height='+w_height+',left='+w_left+',top='+w_top+',status=no,resizable=no,scrollbars=yes';

	fparam = 'templates/ws_mm_estates_10/showdetails.php?pageid=' + theId + '&lang=' + theLang;
  window.showDetailsWindow = open(fparam, 'showDetailsWindow', theWindowParam);
	setTimeout('if(showDetailsWindow&&!showDetailsWindow.closed)showDetailsWindow.focus()',100);
}
function SpecsTabsDisplay(theCase) {

	if (theCase == '1') {
		document.getElementById('Description').style.display = 'block'; 
		document.getElementById('FlatSpecs').style.display = 'none'; 
		document.getElementById('Specs').style.display = 'none'; 
	} else if (theCase == '2') {
		document.getElementById('Description').style.display = 'none'; 
		document.getElementById('FlatSpecs').style.display = 'block'; 
		document.getElementById('Specs').style.display = 'none'; 
	} else if (theCase == '3') {
		document.getElementById('Description').style.display = 'none'; 
		document.getElementById('FlatSpecs').style.display = 'none'; 
		document.getElementById('Specs').style.display = 'block'; 
	}

}

function GalleriesBlocks(theCase) {

	if (theCase == '1') {
		document.getElementById('BigIMageBlock').style.display = 'none'; 
		document.getElementById('PhotosBlock').style.display = 'block'; 
		document.getElementById('imgThreeDBlock').style.display = 'none'; 
		document.getElementById('PlansBlock').style.display = 'none'; 
		document.getElementById('MapBlock').style.display = 'none'; 
	} else if (theCase == '2') {
		document.getElementById('BigIMageBlock').style.display = 'none'; 
		document.getElementById('PhotosBlock').style.display = 'none'; 
		document.getElementById('imgThreeDBlock').style.display = 'block'; 
		document.getElementById('PlansBlock').style.display = 'none'; 
		document.getElementById('MapBlock').style.display = 'none'; 
	} else if (theCase == '3') {
		document.getElementById('BigIMageBlock').style.display = 'none'; 
		document.getElementById('PhotosBlock').style.display = 'none'; 
		document.getElementById('imgThreeDBlock').style.display = 'none'; 
		document.getElementById('PlansBlock').style.display = 'block'; 
		document.getElementById('MapBlock').style.display = 'none'; 
	} else if (theCase == '4') {
		document.getElementById('BigIMageBlock').style.display = 'none'; 
		document.getElementById('PhotosBlock').style.display = 'none'; 
		document.getElementById('imgThreeDBlock').style.display = 'none'; 
		document.getElementById('PlansBlock').style.display = 'none'; 
		document.getElementById('MapBlock').style.display = 'block'; 
	}

}
function ShowPhotoGalleryBigPhoto(theFile, theRecId, thePrevTitle, theNextTitle, theAction) {
	var theTotalPhotosNum = photos_files_ar.length;
	
	if (document.getElementById) {
		//update big photo	
		var c = document.getElementById("bigphoto");
		if (c.style.display != "block") {
			c.innerHTML = '<img src="' + theFile + '" width=640>';
		}

		if (theAction == 'next') {
			theCurrentDisplayPhoto++;
		} else if (theAction == 'prev') {
			theCurrentDisplayPhoto--;
		}
		var next_btn = document.getElementById("next_btn");
		var prev_btn = document.getElementById("prev_btn");
		if (theCurrentDisplayPhoto == 0) { //first photo disable prev button 
			nextPhoto = photos_files_ar[theCurrentDisplayPhoto+1];
			//buttons
			c.innerHTML = '<a href="../../assets/mainmenu/'+theRecId+'/photos/'+nextPhoto+'" onClick="ShowPhotoGalleryBigPhoto(\'../../assets/mainmenu/'+theRecId+'/photos/'+nextPhoto+'\', \''+theRecId+'\', \''+thePrevTitle+'\', \''+theNextTitle+'\', \'next\'); return false;"><img src="' + theFile + '" width="640" border="0"></a>';
			next_btn.innerHTML = '<a href="../../assets/mainmenu/'+theRecId+'/photos/'+nextPhoto+'" onClick="ShowPhotoGalleryBigPhoto(\'../../assets/mainmenu/'+theRecId+'/photos/'+nextPhoto+'\', \''+theRecId+'\', \''+thePrevTitle+'\', \''+theNextTitle+'\', \'next\'); return false;">'+theNextTitle+'</a>';
			prev_btn.innerHTML = 'prev';
			//update and photo link
			//description
		} else if (theCurrentDisplayPhoto == (theTotalPhotosNum-1)) { //last photo disable next button
			prevPhoto = photos_files_ar[theCurrentDisplayPhoto-1];
			
			c.innerHTML = '<img src="' + theFile + '" width="640" border="0">';
			next_btn.innerHTML = 'next';
			prev_btn.innerHTML = '<a href="../../assets/mainmenu/'+theRecId+'/photos/'+prevPhoto+'" onClick="ShowPhotoGalleryBigPhoto(\'../../assets/mainmenu/'+theRecId+'/photos/'+prevPhoto+'\', \''+theRecId+'\', \''+thePrevTitle+'\', \''+theNextTitle+'\', \'prev\'); return false;">'+thePrevTitle+'</a>';
		} else {
			nextPhoto = photos_files_ar[theCurrentDisplayPhoto+1];
			prevPhoto = photos_files_ar[theCurrentDisplayPhoto-1];

			c.innerHTML = '<a href="../../assets/mainmenu/'+theRecId+'/photos/'+nextPhoto+'" onClick="ShowPhotoGalleryBigPhoto(\'../../assets/mainmenu/'+theRecId+'/photos/'+nextPhoto+'\', \''+theRecId+'\', \''+thePrevTitle+'\', \''+theNextTitle+'\', \'next\'); return false;"><img src="' + theFile + '" width="640" border="0"></a>';
			next_btn.innerHTML = '<a href="../../assets/mainmenu/'+theRecId+'/photos/'+nextPhoto+'" onClick="ShowPhotoGalleryBigPhoto(\'../../assets/mainmenu/'+theRecId+'/photos/'+nextPhoto+'\', \''+theRecId+'\', \''+thePrevTitle+'\', \''+theNextTitle+'\', \'next\'); return false;">'+theNextTitle+'</a>';
			prev_btn.innerHTML = '<a href="../../assets/mainmenu/'+theRecId+'/photos/'+prevPhoto+'" onClick="ShowPhotoGalleryBigPhoto(\'../../assets/mainmenu/'+theRecId+'/photos/'+prevPhoto+'\', \''+theRecId+'\', \''+thePrevTitle+'\', \''+theNextTitle+'\', \'prev\'); return false;">'+thePrevTitle+'</a>';

		}
		
	}
	//update photo description
	document.getElementById("photo_descr").value = photos_descr_ar[theCurrentDisplayPhoto];

}

function ShowPlanGalleryBigPhoto(theFile, theRecId, thePrevTitle, theNextTitle, theAction) {
	var theTotalPlansNum = plans_files_ar.length;
	
	if (document.getElementById) {
		//update big photo	
		var c = document.getElementById("planphoto");
		if (c.style.display != "block") {
			c.innerHTML = '<img src="' + theFile + '" width=640>';
		} else {
			c.innerHTML = '<img src="../../layout/images/transparent.gif">';
			c.style.display="none";
		}

		if (theAction == 'next') {
			theCurrentDisplayPlan++;
		} else if (theAction == 'prev') {
			theCurrentDisplayPlan--;
		}
		var next_btn = document.getElementById("next_plans_btn");
		var prev_btn = document.getElementById("prev_plans_btn");
		if (theCurrentDisplayPlan == 0) { //first photo disable prev button 
			nextPhoto = plans_files_ar[theCurrentDisplayPlan+1];
			//buttons
			c.innerHTML = '<a href="../../assets/mainmenu/'+theRecId+'/plans/'+nextPhoto+'" onClick="ShowPlanGalleryBigPhoto(\'../../assets/mainmenu/'+theRecId+'/plans/'+nextPhoto+'\', \''+theRecId+'\', \''+thePrevTitle+'\', \''+theNextTitle+'\', \'next\'); return false;"><img src="' + theFile + '" width=640 border=0></a>';
			next_plans_btn.innerHTML = '<a href="../../assets/mainmenu/'+theRecId+'/plans/'+nextPhoto+'" onClick="ShowPlanGalleryBigPhoto(\'../../assets/mainmenu/'+theRecId+'/plans/'+nextPhoto+'\', \''+theRecId+'\', \''+thePrevTitle+'\', \''+theNextTitle+'\', \'next\'); return false;">'+theNextTitle+'</a>';
			prev_plans_btn.innerHTML = 'prev';
			//description
		} else if (theCurrentDisplayPlan == (theTotalPlansNum-1)) { //last photo disable next button
			prevPhoto = plans_files_ar[theCurrentDisplayPlan-1];
			
			c.innerHTML = '<img src="' + theFile + '" width=640 border=0>';
			next_plans_btn.innerHTML = 'next';
			prev_plans_btn.innerHTML = '<a href="../../assets/mainmenu/'+theRecId+'/plans/'+prevPhoto+'" onClick="ShowPlanGalleryBigPhoto(\'../../assets/mainmenu/'+theRecId+'/plans/'+prevPhoto+'\', \''+theRecId+'\', \''+thePrevTitle+'\', \''+theNextTitle+'\', \'prev\'); return false;">'+thePrevTitle+'</a>';
		} else {
			nextPhoto = plans_files_ar[theCurrentDisplayPlan+1];
			prevPhoto = plans_files_ar[theCurrentDisplayPlan-1];

			c.innerHTML = '<a href="../../assets/mainmenu/'+theRecId+'/plans/'+nextPhoto+'" onClick="ShowPlanGalleryBigPhoto(\'../../assets/mainmenu/'+theRecId+'/plans/'+nextPhoto+'\', \''+theRecId+'\', \''+thePrevTitle+'\', \''+theNextTitle+'\', \'next\'); return false;"><img src="' + theFile + '" width=640 border=0></a>';
			next_plans_btn.innerHTML = '<a href="../../assets/mainmenu/'+theRecId+'/plans/'+nextPhoto+'" onClick="ShowPlanGalleryBigPhoto(\'../../assets/mainmenu/'+theRecId+'/plans/'+nextPhoto+'\', \''+theRecId+'\', \''+thePrevTitle+'\', \''+theNextTitle+'\', \'next\'); return false;">'+theNextTitle+'</a>';
			prev_plans_btn.innerHTML = '<a href="../../assets/mainmenu/'+theRecId+'/plans/'+prevPhoto+'" onClick="ShowPlanGalleryBigPhoto(\'../../assets/mainmenu/'+theRecId+'/plans/'+prevPhoto+'\', \''+theRecId+'\', \''+thePrevTitle+'\', \''+theNextTitle+'\', \'prev\'); return false;">'+thePrevTitle+'</a>';
		
		}
		
	}
	//update photo description
	document.getElementById("plans_descr").value = plans_descr_ar[theCurrentDisplayPlan];
}

function Show3DIMagesGalleryBigPhoto(theFile, theRecId, thePrevTitle, theNextTitle, theAction) {
	var theTotal3DImagesNum = images3D_files_ar.length;
	
	if (document.getElementById) {
		//update big photo	
		var c = document.getElementById("image3Dphoto");
		if (c.style.display != "block") {
			c.innerHTML = '<img src="' + theFile + '" width=640>';
		} else {
			c.innerHTML = '<img src="../../layout/images/transparent.gif">';
			c.style.display="none";
		}

		if (theAction == 'next') {
			theCurrentDisplay3DImage++;
		} else if (theAction == 'prev') {
			theCurrentDisplay3DImage--;
		}
		var next_btn = document.getElementById("next_imgThreeD_btn");
		var prev_btn = document.getElementById("prev_imgThreeD_btn");
		if (theCurrentDisplay3DImage == 0) { //first photo disable prev button 
			nextPhoto = images3D_files_ar[theCurrentDisplay3DImage+1];
			//buttons
			c.innerHTML = '<a href="../../assets/mainmenu/'+theRecId+'/movies/'+nextPhoto+'" onClick="Show3DIMagesGalleryBigPhoto(\'../../assets/mainmenu/'+theRecId+'/movies/'+nextPhoto+'\', \''+theRecId+'\', \''+thePrevTitle+'\', \''+theNextTitle+'\', \'next\'); return false;"><img src="' + theFile + '" width=640 border=0></a>';
			next_imgThreeD_btn.innerHTML = '<a href="../../assets/mainmenu/'+theRecId+'/movies/'+nextPhoto+'" onClick="Show3DIMagesGalleryBigPhoto(\'../../assets/mainmenu/'+theRecId+'/movies/'+nextPhoto+'\', \''+theRecId+'\', \''+thePrevTitle+'\', \''+theNextTitle+'\', \'next\'); return false;">'+theNextTitle+'</a>';
			prev_imgThreeD_btn.innerHTML = 'prev';

		} else if (theCurrentDisplay3DImage == (theTotal3DImagesNum-1)) { //last photo disable next button
			prevPhoto = images3D_files_ar[theCurrentDisplay3DImage-1];
			
			c.innerHTML = '<img src="' + theFile + '" width=640 border=0>';
			next_imgThreeD_btn.innerHTML = 'next';
			prev_imgThreeD_btn.innerHTML = '<a href="../../assets/mainmenu/'+theRecId+'/movies/'+prevPhoto+'" onClick="Show3DIMagesGalleryBigPhoto(\'../../assets/mainmenu/'+theRecId+'/movies/'+prevPhoto+'\', \''+theRecId+'\', \''+thePrevTitle+'\', \''+theNextTitle+'\', \'prev\'); return false;">'+thePrevTitle+'</a>';
		} else {
			nextPhoto = images3D_files_ar[theCurrentDisplay3DImage+1];
			prevPhoto = images3D_files_ar[theCurrentDisplay3DImage-1];

			c.innerHTML = '<a href="../../assets/mainmenu/'+theRecId+'/movies/'+nextPhoto+'" onClick="Show3DIMagesGalleryBigPhoto(\'../../assets/mainmenu/'+theRecId+'/movies/'+nextPhoto+'\', \''+theRecId+'\', \''+thePrevTitle+'\', \''+theNextTitle+'\', \'next\'); return false;"><img src="' + theFile + '" width=640 border=0></a>';
			next_imgThreeD_btn.innerHTML = '<a href="../../assets/mainmenu/'+theRecId+'/movies/'+nextPhoto+'" onClick="Show3DIMagesGalleryBigPhoto(\'../../assets/mainmenu/'+theRecId+'/movies/'+nextPhoto+'\', \''+theRecId+'\', \''+thePrevTitle+'\', \''+theNextTitle+'\', \'next\'); return false;">'+theNextTitle+'</a>';
			prev_imgThreeD_btn.innerHTML = '<a href="../../assets/mainmenu/'+theRecId+'/movies/'+prevPhoto+'" onClick="Show3DIMagesGalleryBigPhoto(\'../../assets/mainmenu/'+theRecId+'/movies/'+prevPhoto+'\', \''+theRecId+'\', \''+thePrevTitle+'\', \''+theNextTitle+'\', \'prev\'); return false;">'+thePrevTitle+'</a>';
		
		}
		
	}
	//update photo description
	document.getElementById("images3D_descr").value = images3D_descr_ar[theCurrentDisplay3DImage];
}

