  DOM = (document.getElementById) ? 1 : 0;

	NS4 = (document.layers) ? 1 : 0;

	Konqueror = (navigator.userAgent.indexOf("Konqueror") > -1) ? 1 : 0;
	Konqueror21 = (navigator.userAgent.indexOf("Konqueror 2.1") > -1 || navigator.userAgent.indexOf("Konqueror/2.1") > -1) ? 1 : 0;
	Konqueror22 = (navigator.userAgent.indexOf("Konqueror 2.2") > -1 || navigator.userAgent.indexOf("Konqueror/2.2") > -1) ? 1 : 0;
	Konqueror2 = Konqueror21 || Konqueror22;

	Opera = (navigator.userAgent.indexOf("Opera") > -1) ? 1 : 0;
	Opera5 = (navigator.userAgent.indexOf("Opera 5") > -1 || navigator.userAgent.indexOf("Opera/5") > -1) ? 1 : 0;
	Opera6 = (navigator.userAgent.indexOf("Opera 6") > -1 || navigator.userAgent.indexOf("Opera/6") > -1) ? 1 : 0;
	Opera56 = Opera5 || Opera6;

	IE = (document.all) ? 1 : 0;
	IE4 = IE && !DOM;

	isIE = false;
	navVer = navigator.appVersion;
	ver = parseFloat(navVer);
	IEPos = navVer.indexOf('MSIE');

	if (IEPos !=-1) {
  		isIE = true;
  		ver = parseFloat(navVer.substring(IEPos+5,navVer.indexOf(';',IEPos)));
	}

	isIE5up = (isIE && ver >= 5);
 
	isWin = false;

	if (navigator.appVersion.indexOf("Windows") > -1)
	{
		isWin = true;
	}

	function imgchg(ID,name,type){
		if(type!='0'){
       img_src = imag_over[ID].src;
     } else {
       img_src = imag[ID].src;
     }

		if (isIE && isWin && !Opera){
			obj = document.all(name);
			obj.filters.blendTrans.Apply();
  		obj.src = img_src;
  		obj.filters.blendTrans.Play();
		} else {
			obj = document.getElementById(name);
			obj.src = img_src;
		}
  }


	function setBookmark(){
		HomePage = top.location.href;
		window.external.AddFavorite(HomePage,'ПРОПЕРТИ ТАЙМС - Профессионально о недвижимости');
	}

	function setNSHomepage(URL) {  // this HAS to be signed if it is to run on the web
  		var Text = '';

		Text += 'Due to Netscapes security handling, making this page your homepage, will show you a dialog with a warning.\n';
  		Text += 'If you do not wish to grant this site the access to your browser settings,';
  		Text += ' you can manually copy the current location and paste it in the location field in Edit / Preferences / Navigator.';

		if (confirm(Text)) {
			netscape.security.PrivilegeManager.enablePrivilege("UniversalPreferencesWrite");
    		navigator.preference('browser.startup.homepage',URL);
  		}
	}

	function preSetHome(lnk){

		HomePage = top.location.href;

		if (document.layers){
			setNSHomepage(HomePage);
		} else if (isIE5up) {
   		lnk.style.behavior='url(#default#homepage)';
   		lnk.setHomePage(HomePage);
		} else {
			alert('Sorry, not supported in this browser,\n please change this setting manually');
		}

		return false;
	}


	function hideLevel(ID,FRAME) {

		if (FRAME == '0'){
			FRAME = document;
		} else {
			FRAME = parent.document;
		}

		if ((DOM && !Opera56 && !Konqueror2) || IE4) {
      for(i=0;i<=25;i++){
			  if (!IE4) {
				    obj = FRAME.getElementById("level"+i);
        } else {
				    obj = FRAME.all("level"+i);
        }

    	  if (i==ID){
          obj0 = obj;
        } else {
          obj.style.display = "none";
        }
     }
     obj0.style.display = "block";
		}
}
 
  	function hideAllLevels(LEVEL,COUNT,FRAME) {

		if (FRAME == '0'){
			FRAME = document;
		} else {
			FRAME = parent.document;
		}


  	if ((DOM && !Opera56 && !Konqueror2) || IE4) {
          for(i=1;i<=COUNT;i++){
			       if (!IE4) {
				         obj = FRAME.getElementById(LEVEL+i);
             } else {
				         obj = FRAME.all(LEVEL+i);
             }

             obj.style.display = "none";
          }
          
          if (!IE4) {
				      obj0 = FRAME.getElementById("level0");
          } else {
				      obj0 = FRAME.all("level0");
			    }
       
          obj0.style.display = "block";
		}

 	}

  function PopWindow(targetURL,caption,width,height) {
   	window.open("./displayProductImage.php?image="+targetURL+"&title="+caption,"Fenster2","titlebar=no,toolbar=no,location=no,directories=no,menubar=no,resizable=yes,scrollbars=no,width="+width+",height="+height+",status=no");
  }
  
  function PopWindow2(targetURL,caption,width,height) {
   	window.open("./displayPhoto.php?image="+targetURL+"&title="+caption,"Fenster2","titlebar=no,toolbar=no,location=no,directories=no,menubar=no,resizable=yes,scrollbars=yes,width="+width+",height="+height+",status=no");
  }

  function PopupWindow(targetURL,caption,sbs,rc,sq,lc) {
   	window.open("/plan/displayflat.html?flat="+targetURL+"&title="+caption+"&rc="+rc+"&sq="+sq+"&lc="+lc,"","titlebar=no,toolbar=no,location=no,directories=no,menubar=no,resizable=yes,scrollbars="+sbs+",status=no");
  }
