function trim(str, chars) {
	return ltrim(rtrim(str, chars), chars);
}
 
function ltrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}
 
function rtrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}

function ValidateStringLength(theString) {
	var theTrimString = trim(theString);
	if (theTrimString.length == '0') {
		return false;	
	} else {
		return true;
	}	
}

function ValidateContactForm (form) { // Used in Give us your feedback page (pageid=5&ctype=bm)
  var fname = form.fullname.value;   
  var country = form.country.value;   
	var phone = form.phone.value;
  var email = form.email.value;   

  if (!fname)	{
    alert("You must enter your full name.");
    return false;
	} else if (!country) {
		alert("You must select your country.");
		return false;
	} else if ((!phone)&&(!email)) {
		alert("You must enter your phone number or your email address.");
		return false;
	} else if ((email)&&((email.indexOf('@') == -1) || (email.indexOf('.') == -1))) {
		alert("Wrong email format.");
		return false;
	} else {
		return true;
	}
}
function ValidateMailingListRequestForm (form) { // Used in Give us your feedback page (pageid=5&ctype=bm)
  var email = form.email.value;   

	if (!email) {
		alert("You must enter your email.");
		return false;
	} else if ((email.indexOf('@') == -1) || (email.indexOf('.') == -1)) {
		alert("Wrong email format.");
		return false;
	} else {
		return true;
	}
}
function ValidateEnquireService(form) {
	var service = form.service.value;  
	var fullname = form.fullname.value;  
	var email = form.email.value;  
	var phone = form.phone.value;  
	var start_date = form.start_date.value;  
	var number_of_adults = form.number_of_adults.value; 
	
  if (!service)	{
    alert("You must select a service.");
    return false;
	} else if (!fullname) {
		alert("You must enter your full name.");
		return false;
	} else if (!email) {
		alert("You must enter your email.");
		return false;
	} else if ((email.indexOf('@') == -1) || (email.indexOf('.') == -1)) {
		alert("Wrong email format.");
		return false;
	} else if (!phone) {
		alert("You must enter your phone number.");
		return false;
	} else if (!start_date) {
		alert("You must enter starting date.");
		return false;
	} else if (!number_of_adults) {
		alert("You must enter number of adults.");
		return false;
	} else {
		return true;
	}
}

function showMap() {
	w_width = 640;
	w_height = 400;
	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=no';

	fparam = 'showmap.html';
  window.showMapWindow = open(fparam, 'showMapWindow', theWindowParam);
	setTimeout('if(showMapWindow&&!showMapWindow.closed)showMapWindow.focus()',100);
}
function showContact() {
	w_width = 640;
	w_height = 400;
	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=no';

	fparam = 'showcontact.html';
  window.showContactWindow = open(fparam, 'showContactWindow', theWindowParam);
	setTimeout('if(showContactWindow&&!showContactWindow.closed)showContactWindow.focus()',100);
}
function printPage() {
  lochref = '' + this.location;
	if (lochref.indexOf('?') > 0) {
		lochref = '?' + lochref.substring((lochref.indexOf('?')) + 1);
	} else {
		lochref = '';
	}

	w_width = 750;
	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=no,scrollbars=yes';

	fparam = 'print.php'+lochref;
  window.showPrintWindow = open(fparam, 'showPrintWindow', theWindowParam);
	setTimeout('if(showPrintWindow&&!showPrintWindow.closed)showPrintWindow.focus()',100);
}
function emailPage() {
  lochref = '' + this.location;
	if (lochref.indexOf('?') > 0) {
		lochref = '?' + lochref.substring((lochref.indexOf('?')) + 1);
	} else {
		lochref = '';
	}

	w_width = 500;
	w_height = 400;
	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=no';

	fparam = 'tools/emailpage/index.php'+lochref;
  window.showEmailWindow = open(fparam, 'showEmailWindow', theWindowParam);
	setTimeout('if(showEmailWindow&&!showEmailWindow.closed)showEmailWindow.focus()',100);
}
function NltSubscribeWindow() {
	w_width = 550;
	w_height = 370;
	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=no';

	fparam = 'tools/newsletter_subscription/index.php';
  window.NltSubWindow = open(fparam, 'NltSubWindow', theWindowParam);
	setTimeout('if(NltSubWindow&&!NltSubWindow.closed)NltSubWindow.focus()',100);
}
function ValidateNltSubscriptionForm (form) { // Used in Give us your feedback page (pageid=5&ctype=bm)
  var fname = form.fullname.value;   
  var email = form.email.value;   
  var scode = form.security_code.value;   

	if (ValidateStringLength(fname) == false) {
		alert("You must enter your fullname.");
		return false;
	} else if (ValidateStringLength(email) == false) {
		alert("You must enter your email.");
		return false;
	} else if ((email.indexOf('@') == -1) || (email.indexOf('.') == -1)) {
		alert("Wrong email format.");
		return false;
	} else if (ValidateStringLength(scode) == false) {
		alert("Type the code shown");
		return false;
	} else {
		return true;
	}
}
function popupWindow (theWindow, theParam) {

//	newLeft = screen.width
//	newTop = screen.height
	switch (theWindow)
	{
		case 'newmenu':
			window.open('menuform.php?'+theParam, 'NewMenu', 'toolbar=no,status=no,scrollbars=yes,resizable=yes,location=no,menubar=no,directories=no,width=500,height=500,left=50,top=50');
		break
		case 'editmenu':
			window.open('menuform.php?'+theParam, 'EditMenu', 'toolbar=no,status=no,scrollbars=yes,resizable=yes,location=no,menubar=no,directories=no,width=500,height=500,left=50,top=50');
		break
		default:
			return;
	}
}
function changeLangAlert(theLang) {
	alert('The '+theLang+' language is not published yet. Please check back soon.');
}
function changeLang(theLang) {
  lochref = '' + this.location;
	if (lochref.match('lang=') != null) {
		langPos = lochref.indexOf('lang=');
		lochref = lochref.substring(0,(langPos-1))+lochref.substring((langPos-1)+8);
	}
	// Check all parameters that 'index.php' files handles
	if ( (lochref.match("pageid=") == null) && (lochref.match("smpageid=") == null) ) {
		lochref = 'index.php?lang=' + theLang;
	} else {
		if (lochref.match("smpageid=") != null) {
			lochref = 'index.php?'+lochref.substring(lochref.indexOf('smpageid='))+'&lang=' + theLang;
		} else {
			lochref = 'index.php?'+lochref.substring(lochref.indexOf('pageid='))+'&lang=' + theLang;
		}
	}
//alert ('Location= '+lochref);
	location = lochref;
}
function goToSearch(theform) {
  var theSearchQuery = theform.searchquery.value;
	
  lochref = 'index.php?pageaction=search&searchquery=' + theSearchQuery;
	
	location = lochref;
}
function goToSitemap() {

  lochref = 'index.php?pageaction=sitemap';

	location = lochref;
}
function ClearSearchField(theForm) {
 theForm.searchquery.value = '';
}



//v1.0
//Copyright 2006 Adobe Systems, Inc. All rights reserved.
function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else
    return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
  var str = '<object ';
  for (var i in objAttrs)
    str += i + '="' + objAttrs[i] + '" ';
  str += '>';
  for (var i in params)
    str += '<param name="' + i + '" value="' + params[i] + '" /> ';
  str += '<embed ';
  for (var i in embedAttrs)
    str += i + '="' + embedAttrs[i] + '" ';
  str += ' ></embed></object>';

  document.write(str);
}

function AC_FL_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_SW_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
     , null
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    

    switch (currArg){	
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":	
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "id":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}

function ChangeMainMenuImg(theId, theCase, theLang) {
	if (theCase == '1') {
		document.getElementById("mm_" + theId).src = "layout/images/mm_title_" + theId + "_over_" + theLang + ".png";
	} else if (theCase == '2') {
		document.getElementById("mm_" + theId).src = "layout/images/mm_title_" + theId + "_on_" + theLang + ".png";
	}
}

function topic_DefaultSlideDelay(thePageId, theLang, rotate, theSlideDelay) {
	var DefSlideNumFindDelay = ShowSlideNum+1;
	var theDefNextSlideDelay = 4000;
	setTimeout("topic_UpdateSlide('"+thePageId+"', '"+theLang+"', '"+rotate+"', '', "+theDefNextSlideDelay+")", theSlideDelay);
}

function topic_UpdateSlide(thePageId, theLang, rotate, theSlideNum, theSlideDelay) {	
	/* setup loading block */
	var new_block_h = parseInt(document.getElementById("SlideBlock").scrollHeight, 10);
	var new_block_w = parseInt(document.getElementById("SlideBlock").scrollWidth, 10);
	//new_block_h = new_block_h-33;//paging row height
	document.getElementById("block_loading").style.width = new_block_w+"px";
	document.getElementById("block_loading").style.height = new_block_h+"px";
	
	document.getElementById("block_loading").style.display = "block";
	setTimeout('document.images["block_loading_img"].src = "layout/images/loading.gif"', 10); 
	document.getElementById("block_loading_img").style.marginTop = ((new_block_h/2)-32);
	/* */
		
	/* Slide Conf */
	var TotalSlides = parseInt(document.getElementById("total_slides").value,10);	
	TotalSlides = TotalSlides-1; //because slides num starts from 0
	
	var SlideNumParam = parseInt(theSlideNum,10);
	if ((SlideNumParam >= 0)&&(SlideNumParam<=TotalSlides)) {
		ShowSlideNum = SlideNumParam;
	} else {
		if (ShowSlideNum < TotalSlides) {
			ShowSlideNum++;
		} else {
			ShowSlideNum = 0;
		}
	}

  /*
	if (TotalSlides > 0) {
	  for(var c=0;c<=TotalSlides;c++) {
		  if (c == ShowSlideNum) {
		    document.getElementById("nav_"+c).src = "layout/images/sshow_sel_btn.png";
		  } else {
		    document.getElementById("nav_"+c).src = "layout/images/sshow_on_btn.png";
		  }
	  }
	}
	*/
		
	/** NEXT SLIDE NUM TO FIND DELAY ***/
	var SlideNumFindDelay = ShowSlideNum+1;
	if (SlideNumFindDelay > TotalSlides) {
		SlideNumFindDelay = 0;
	}
	var theNextSlideDelay = 4000;
	/****/
	
	clearTimeout(timeout);
		
	if (rotate) {
	  timeout = setTimeout("topic_UpdateSlide('"+thePageId+"', '"+theLang+"', '"+rotate+"', '', "+theNextSlideDelay+")", theSlideDelay);
	}	
			
	var ajaxRequest; 
	try {
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try {
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Something is wrong with your browser!");
				return false;
			}
		}
	}
			
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4) {
			$("#SlideBlock").fadeOut(0, function() {
			  var Res = ajaxRequest.responseText;
				var ResArr = Res.split("|");
				var ResLink = ResArr[0];
				var ResBody = ResArr[1];
				/**/
				if (ResLink) {
				  if (document.getElementById('photo_link')) {
				    document.getElementById('photo_link').setAttribute("href", ResLink);
					}
				} else {
				  if (document.getElementById('photo_link')) {
					  document.getElementById('photo_link').removeAttribute("href");
				  }
				}
				/**/
				$("#SlideBlock").html(ResBody);
			});
			$("#SlideBlock").fadeIn('slow');
			/*
			var ajaxDisplay = document.getElementById("SlideBlock");
			ajaxDisplay.innerHTML = ajaxRequest.responseText;
			*/
		}
	}
		
	var queryString = "?pageid="+thePageId+"&lang="+theLang+"&slide="+ShowSlideNum;
	ajaxRequest.open("GET", "templates/ws_bl_featuredarticle_02/update_slide.php"+queryString, true);
	ajaxRequest.send(null); 
}

function TopicNavigation(thePageId, NextOrPrev, theLang) {
	theSlideNum = 0;
	if (NextOrPrev == 'P') {
	  if (ShowSlideNum > 0) {
	    theSlideNum = ShowSlideNum - 1;
		} else {
	    theSlideNum = document.getElementById("total_slides").value - 1;
		}
	} else {
	  theSlideNum = ShowSlideNum + 1;
	}
	
	topic_UpdateSlide(thePageId, theLang, false, theSlideNum, 4000);
}

function ChangeEnquireBtn(theCase, theLang) {
	if (theCase == '1') {
		document.getElementById("enquire").src = "layout/images/enquireproperty_over_" + theLang + "_btn.png";
	} else if (theCase == '2') {
		document.getElementById("enquire").src = "layout/images/enquireproperty_on_" + theLang + "_btn.png";
	}
}

function ChangePhotoGalleryBtn(theCase, theLang) {
	if (theCase == '1') {
		document.getElementById("photogallery").src = "layout/images/photogallery_over_" + theLang + "_btn.gif";
	} else if (theCase == '2') {
		document.getElementById("photogallery").src = "layout/images/photogallery_on_" + theLang + "_btn.gif";
	}
}

function ChangePlanGalleryBtn(theCase, theLang) {
	if (theCase == '1') {
		document.getElementById("plangallery").src = "layout/images/plangallery_over_" + theLang + "_btn.gif";
	} else if (theCase == '2') {
		document.getElementById("plangallery").src = "layout/images/plangallery_on_" + theLang + "_btn.gif";
	}
}

function ChangeLocationMapBtn(theCase, theLang) {
	if (theCase == '1') {
		document.getElementById("locationmap").src = "layout/images/googlemap_over_" + theLang + "_btn.gif";
	} else if (theCase == '2') {
		document.getElementById("locationmap").src = "layout/images/googlemap_on_" + theLang + "_btn.gif";
	}
}

function ChangeDetImg(theCase, theId, theLang) {
	if (theCase == '1') {
		document.getElementById(theId + "_det_img").src = "layout/images/tab_details_over_" + theLang + ".png";
	} else if (theCase == '2') {
		document.getElementById(theId + "_det_img").src = "layout/images/tab_details_on_" + theLang + ".png";
	}
}

function ChangeDescrImg(theCase, theId, theLang) {
	if (theCase == '1') {
		document.getElementById(theId + "_descr_img").src = "layout/images/tab_description_over_" + theLang + ".png";
	} else if (theCase == '2') {
		document.getElementById(theId + "_descr_img").src = "layout/images/tab_description_on_" + theLang + ".png";
	}
}

function ChangeTechImg(theCase, theId, theLang) {
	if (theCase == '1') {
		document.getElementById(theId + "_tech_img").src = "layout/images/tab_technical_over_" + theLang + ".png";
	} else if (theCase == '2') {
		document.getElementById(theId + "_tech_img").src = "layout/images/tab_technical_on_" + theLang + ".png";
	}
}

function ChangeBuildImg(theCase, theId, theLang) {
	if (theCase == '1') {
		document.getElementById(theId + "_build_img").src = "layout/images/tab_building_over_" + theLang + ".png";
	} else if (theCase == '2') {
		document.getElementById(theId + "_build_img").src = "layout/images/tab_building_on_" + theLang + ".png";
	}
}

function showGallery(theId, theLang, theType) {
	if ((theType == 'Photo')||(theType == 'Plan')) {
		w_width = 830;
		w_height = 640;
	} else if (theType == 'Video') {
		w_width = 550;
		w_height = 450;
	}
	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_23/showgallery.php?pageid=' + theId+'&lang=' + theLang +'&type='+ theType;
  window.showGalleryWindow = open(fparam, 'showGalleryWindow', theWindowParam);
	setTimeout('if(showGalleryWindow&&!showGalleryWindow.closed)showGalleryWindow.focus()',100);
}
function showEnquiry(theId, theLang) {	
	w_width = 630;
	w_height = 800;
	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_23/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_23/showspecs.php?pageid=' + theId + '&lang=' + theLang;
  window.showSpecificationsWindow = open(fparam, 'showSpecificationsWindow', theWindowParam);
	setTimeout('if(showSpecificationsWindow&&!showSpecificationsWindow.closed)showSpecificationsWindow.focus()',100);
}
function showPhoto(theId, theLang, thePhotoNum) {
	w_width = 800;
	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_23/showphoto.php?pageid=' + theId + '&lang=' + theLang + '&photonum=' + thePhotoNum;
  window.showPhotoWindow = open(fparam, 'showPhotoWindow', theWindowParam);
	setTimeout('if(showPhotoWindow&&!showPhotoWindow.closed)showPhotoWindow.focus()',100);
}
function showLocationMap(theId, thePhoto, theLang) {
	w_width = 800;
	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_23/showphoto.php?pageid=' + theId + '&lang=' + theLang + '&map=' + thePhoto;
  window.showPhotoWindow = open(fparam, 'showPhotoWindow', theWindowParam);
	setTimeout('if(showPhotoWindow&&!showPhotoWindow.closed)showPhotoWindow.focus()',100);
}
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 ValidatePropertyEnquiryForm (form) { // Used in Give us your feedback page (pageid=5&ctype=bm)
  var fname = form.fullname.value;   
  var country = form.country.value;   
	var phone = form.phone.value;
  var email = form.email.value;   

  if (!fname)	{
    alert("You must enter your full name.");
    return false;
	} else if (!country) {
		alert("You must select your country.");
		return false;
	} else if ((!phone)&&(!email)) {
		alert("You must enter your phone number or your email address.");
		return false;
	} else if ((email)&&((email.indexOf('@') == -1) || (email.indexOf('.') == -1))) {
		alert("Wrong email format.");
		return false;
	} else {
		return true;
	}
}
function ShowPhotoSrc(theId, theFile, theDescId, theDesc, theType) {
	if (document.getElementById) {
		var c = document.getElementById(theId);
		if (c.style.display != "block") {
			if ((theType == 'Photo')||(theType == 'Plan')) {
				c.innerHTML = '<img src="' + theFile + '">';
			} else if (theType == 'Video'){
				c.innerHTML =  '<OBJECT ID="EstatesVideo" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,02,902" standby="Loading Microsoft® Windows® Media Player components..." type="application/x-oleobject"><PARAM NAME="FileName" VALUE="'+theFile+'"><PARAM NAME="animationatStart" VALUE="true"><PARAM NAME="transparentatStart" VALUE="true"><PARAM NAME="autoStart" VALUE="true"><PARAM NAME="showControls" VALUE="true"><EMBED type="application/x-mplayer2" pluginspage = "http://www.microsoft.com/Windows/MediaPlayer/" SRC="'+theFile+'" name="EstatesVideo" AutoStart=true></EMBED></OBJECT>';
			}
		} else {
			c.innerHTML = '<img src="../../layout/images/transparent.gif">';
			c.style.display="none";
		}
	}
	if ((theType == 'Photo')||(theType == 'Plan')) {
	document.getElementById(theId).alt = theDesc;
	}
	document.getElementById(theDescId).value = theDesc;
}
function showDetails() {
	document.getElementById('details').style.display = 'block'; 
	document.getElementById('descr').style.display = 'none'; 
	document.getElementById('technicalspecs').style.display = 'none'; 
	document.getElementById('buildingspecs').style.display = 'none'; 
}
function showDescription() {
	document.getElementById('details').style.display = 'none';
	document.getElementById('descr').style.display = 'block'; 
	document.getElementById('technicalspecs').style.display = 'none'; 
	document.getElementById('buildingspecs').style.display = 'none'; 
}
function showTechnicalSpecs() {
	document.getElementById('details').style.display = 'none';
	document.getElementById('descr').style.display = 'none'; 
	document.getElementById('technicalspecs').style.display = 'block'; 
	document.getElementById('buildingspecs').style.display = 'none'; 
}
function showBuildingSpecs() {
	document.getElementById('details').style.display = 'none';
	document.getElementById('descr').style.display = 'none'; 
	document.getElementById('technicalspecs').style.display = 'none'; 
	document.getElementById('buildingspecs').style.display = 'block'; 
}

function IF_05_BlockNavButtons(BlockNum, CurBlockPage, TotalBlockPages, QueryString){
	var ajaxRequest; 

	/* setup loading block */
	var new_block_h = parseInt(document.getElementById("block_" + BlockNum).scrollHeight, 10);
	var new_block_w = parseInt(document.getElementById("block_" + BlockNum).scrollWidth, 10);
	new_block_h = new_block_h; // paging row height
	document.getElementById("block_" + BlockNum + "_loading").style.width = new_block_w + "px";
	document.getElementById("block_" + BlockNum + "_loading").style.height = new_block_h + "px";
	
	document.getElementById("block_" + BlockNum + "_loading").style.display = "block";
	// setTimeout('document.images["block_"' + BlockNum + '"_loading_img"].src = "layout/images/loading.gif"', 10); 
	document.getElementById("block_" + BlockNum + "_loading_img").style.marginTop = ((new_block_h / 2) - 16);
	/* */
	
	try {
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try {
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Something is wrong with your browser!");
				return false;
			}
		}
	}
	
	var RecIdStr = document.getElementById("recIdStr").value;
	var ParIdStr = document.getElementById("parIdStr").value;
	var queryString = "?blockNum=" + BlockNum + "&curpage=" + CurBlockPage + "&pagesnum=" + TotalBlockPages + "&recIdStr=" + RecIdStr + "&parIdStr=" + ParIdStr + QueryString;
	
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4) {
			var ajaxDisplay = document.getElementById("block_" + BlockNum);
			ajaxDisplay.innerHTML = ajaxRequest.responseText;
		}
	}
	ajaxRequest.open("GET", "templates/ws_bl_internalfeed_05/update_block.php" + queryString, true);
	ajaxRequest.send(null); 
}


function ImgOverEffect(theImgId) {
  if (document.getElementById(theImgId+'_on')) {
	 var CurStyle = document.getElementById(theImgId+'_on').style.display;
	 if (CurStyle == "block") {
		 document.getElementById(theImgId+'_on').style.display = "none";
		 document.getElementById(theImgId+'_over').style.display = "block";
	 } else {
		 document.getElementById(theImgId+'_on').style.display = "block";
		 document.getElementById(theImgId+'_over').style.display = "none";
	 }
  }
	
}


