
function show(id){
	layer = document.getElementById(id);
	if(layer.style.display == "none")
		layer.style.display = "block";
	else 
		layer.style.display = "none";
}
function pics( img , url ) {
		document.images[img].src = url;
}

function activeButton(id){
	var button  = document.getElementById(id);
	button.className = 'a_button';
}

function passiveButton(id){
	var button  = document.getElementById(id);
	button.className = 'i_button';
}

function openwin(img , w , h , title )
{
	var hWnd;
	if(hWnd!=null)
	hWnd.close();
	hWnd=window.open(img,"","toolbar=no,location=no,directories=no,resizable=no,width=" + w + ",height=" + h );
	hWnd.document.open();
	hWnd.document.write("<html>");
	hWnd.document.write("<head>");
	hWnd.document.write("<title>" + title + "</title>");
	hWnd.document.write("</head>");
	hWnd.document.write("<body bgcolor=#ffffff bottommargin=0 leftmargin=0 marginheight=0 marginwidth=0 rightmargin=0 topmargin=0 style='border:0px;'>");
	hWnd.document.write("<table align=center width=100% height=100% cellspacing=0 cellpadding=0 border=0>");
	hWnd.document.write("<tr><td><img src='"+img+"' border=0></td></tr>");
	hWnd.document.write("</table></body></html>");
	hWnd.document.close();
}

function openwin_text(url , w , h)
{
	window.open(url,"","toolbar=no,location=no,directories=no,resizable=no,scrollbars=yes,width="+w+",height="+h);
}

function addBookmark(url, title){
  
  if (!url) url = location.href;
  if (!title) title = document.title;
  

  if ((typeof window.sidebar == "object") && (typeof window.sidebar.addPanel == "function")) window.sidebar.addPanel 
(title, url, "");
 
  else if (typeof window.external == "object") window.external.AddFavorite(url, title);
 
   else if (window.opera && document.createElement)
  {
    var a = document.createElement('A');
    if (!a) return false; //IF Opera 6
    a.setAttribute('rel','sidebar');
    a.setAttribute('href',url);
    a.setAttribute('title',title);
    a.click();
  }
  else return false;
  
  return true;
}

function IEPngFix( img , width , height , unique_name ) {

	var code = '<IMG SRC="'+ img +'" WIDTH="' + width + '" HEIGHT="' + height + '" BORDER=0 name='+ unique_name +'>';
	if( navigator.userAgent.indexOf("Opera") > 1 )
		document.write(code);
	else
		if( navigator.userAgent.indexOf("MSIE 6") > 1 )
			document.write('<IMG SRC="/img/emp.gif" WIDTH="' + width + '" HEIGHT="' + height + '" BORDER="0" ALT="" STYLE="filter: progid:DXImageTransform.Microsoft.AlphaImageLoader (src=' + img + ' , sizingMethod=scale );">');
		else
			if(navigator.userAgent.indexOf("MSIE 5") != -1)
				document.write(code);
			else
				document.write(code);
				
}
function Showmenu() {
	Hidemenu();
	var i,TopPosition,args = Showmenu.arguments;
	for (i=0; i<(args.length); i+=1) {
		if (document.layers) { // NN 4.xx
			eval('var CurrentLayer = document.layers[\'' + args[i] + '\'];');
			if (CurrentLayer) CurrentLayer.visibility = 'show';
			document.layers['HideLayer'].visibility = 'show';
		}
		else { // IE 4+, NN 6.xx, Opera 6.xx
			eval('var CurrentLayer = document.getElementById(\'' + args[i] + '\');');
			if (CurrentLayer) CurrentLayer.style.visibility = 'visible';
			CurrentLayer = document.getElementById('HideLayer');
			CurrentLayer.style.visibility = 'visible';
		}
	}
}


function Hidemenu() {
	var LayersCollection,i,CurrentLayerID,Currentlayer;
		LayersCollection = document.getElementsByTagName("div");
		for (i=0; i<LayersCollection.length; i+=1) {
			CurrentLayerID = LayersCollection[i].id;
			if (CurrentLayerID.indexOf('Layer') >= 0) {
				eval('Currentlayer = document.getElementById(\'' + CurrentLayerID + '\');');
				Currentlayer.style.visibility = 'hidden';
			}
		}
}

function showFloorPlan ( building_id ) {
	wnd = window.open("/objects/index.php?act=view_plan&id="+building_id,"","scrollbars=yes,toolbar=no,resizable=no,width=1000,height=600");
	return false;	
}

function jump2 ( url, w,h ) {
	wnd = window.open(url,"","toolbar=no,scrollbars=yes,width="+w+",height="+h);
	return false;	
}

function cl(link)
{
 img = new Image();
 img.src = 'http://www.liveinternet.ru/click?*' + link;
}


