function Info(){
	this.width = 264;
	this.height = 137;

    this.info = document.createElement("div");
	this.info.id = "allinfo";
	this.info.onmouseover = function(){clearInterval(allinfo.time);}
 	this.info.onmouseout = function(){allinfo.setInt(600);}
	document.getElementsByTagName("body")[0].appendChild(this.info);
	
	this.setInfo = function(id,nfo){
		this.id = id;
		this.nfo = nfo;
	}

	this.show = function(id,x,y,nfo,color){	
      	if (this.time != "") {
	  		clearInterval(this.time);
		}
		this.id = id;
		this.nfo = nfo;

		this.info.style.width = this.width +"px";

		if(id=="photo"){
			this.info.style.height = this.height +"px";
		this.info.className = '';
        	var text = ["<p class='photo'></p><div class='photod' align='center'><a href=",this.nfo["img_big"]," onclick='allinfo.photoBig(); return false'><img id='preload' src='/images/loading_bar_2.gif' alt='' /><img style='z-index: 501; position: relative' src='",this.nfo["img_small"]," alt='' onload='this.previousSibling.style.display = \"none\"'/></a><p>",this.nfo["date"],"</p></div>"].join("");
            }
		if(id=="pan"){
			this.info.style.height = this.height +"px";
		this.info.className = '';
        	var text = ["<p class='photo'></p><div class='photod' align='center'><a onclick='allinfo.panBig(); return false'><img id='preload' src='/images/loading_bar_2.gif' alt='' /><img style='z-index: 501; position: relative' src='",this.nfo["img_small"]," alt='' onload='this.previousSibling.style.display = \"none\"'/></a><p>",this.nfo["date"],"</p></div>"].join("");
            }
		if(id=="sticker"){
		  	this.info.style.height = "auto";
			this.info.className = 'noback';
            if(color)
	        	this.info.style.backgroundColor = color;
			else
	        	this.info.style.backgroundColor = "#fff";
        	var text = ["<p class='sticker'>",this.nfo["name"],"</p><div><p>",this.nfo["dsc"],"</p><br/><p class='right'>",this.nfo["date"],"</p><p class='left'>",this.nfo["user"],"</p></div>"].join("");
            }
		if(id=="object"){
		this.info.className = '';
		  var text = "<p class='photo'></p><div class='photod'><div id='ics'>";
            for (var i=0; i<this.nfo.category.length; i++){
                //if(this.nfo.category[i]!=this.nfo.icon){
					text = text + ["<img width='25' height='25' src='",icons[this.nfo.category[i]].small,"' title='",icons[this.nfo.category[i]].name,"'/>"].join("");
				//}
            }
		   	text = text + ["</div><div class='nfo'><p><strong>",this.nfo["name"],"</strong></p><p class='gr'>",words["adress"],this.nfo["adress"],"</p></div>"].join("");

			text = [text,"<br clear='all'/><p id='ank'><a class='ank' href='#' onclick='showObjectId("+this.nfo["id"]+"); return false'>",words["anketa"],"</a></p></div>"].join("");
          }
		if(id=="map"){
		this.info.className = '';
        	var text = "<p class='photo'></p><div class='photod'><center><img src='/images/loading_bar_2.gif'></center></div>";
            this.info.style.height = "auto";
			}
        if(id=="mark"){
			this.info.className = 'noback';	
			this.info.style.backgroundColor = "#fff";
		//	this.info.className = '';
        	var text = ["<p class='sticker'>",this.nfo["name"],"</p><div class='photod'><p  class='gr'>",this.nfo["dsc"],"</p><br/><strong>",this.nfo["author"],"</strong><p>",this.nfo["date"],"</p></div>"].join("");
			this.info.style.height = "auto";
		}

		this.info.innerHTML = text;
       	this.info.style.display = "block";

		this.x = x + map.deltaleft + map.proX + 14;
		this.y = y + map.deltatop + map.proY - this.info.offsetHeight - 10;

        if(this.y<map.deltatop)
			this.y = (map.level<=2) ? this.y + this.info.offsetHeight +  40 : this.y + this.info.offsetHeight + 30;

        if((this.x+this.width)>(map.deltaleft+map.scrmapw))
			this.x = (map.level<=2) ? this.x - this.width -  20 : this.x - this.width - 10;


        this.info.style.left = this.x + "px";
		this.info.style.top = this.y +"px";



	}
	this.setInt = function(t){
		if (this.time != "") {
	  		clearInterval(this.time);
		}
		this.time = setInterval("allinfo.clearInfo()",t);
	}
	this.clearInfo = function(){
			allinfo.info.style.display = "none";
            clearInterval(allinfo.time);
			allinfo.time = "";
	}
	this.setText = function(text){
			this.info.innerHTML = text;;
	}
	this.photoBig = function(){
		num_photo_view(this.nfo.id_photo);
        var text = ["<p class='photobig'><a href='#' onclick='allinfo.clearInfo(); return false'><img src='images/close.gif' width='12' height='12' align='right' alt='' /></a><span>",this.nfo["date"],"</span><strong>",this.nfo["author"],"</strong>&nbsp;&nbsp;&nbsp;&nbsp;<em>"+this.nfo["name"],"</em></p><div class='photod big'><center><img src='",this.nfo["img_big"],"'/></center></div><p class='count'>",words["count"],this.nfo["img_count"],"</p><p class='biginfo'>",this.nfo["dsc"],"</p><p class='tobig'><span title='Скопировать ссылку в буфер'>Ссылка на фотографию: <object id='clip' classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='162' height='16'><param name='allowScriptAccess' value='sameDomain' /><param name='flashvars' value='url=http://", location.host, "/?photo=", this.nfo.id_photo, "'><param name='allowFullScreen' value='false' /><param name='movie' value='/images/clipboard.swf' /><param name='quality' value='high' /><embed src='/images/clipboard.swf' quality='high' width='162' height='16' flashvars='url=http://", location.host, "/?photo=", this.nfo.id_photo, "' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' /></object></span><br/><a href='",this.nfo["img_biggest"],"' target='_blank'>для просмотра исходной версии фотографии нажмите здесь</a><br/>(откроется в новом окне)</p>"].join("");
   		allinfo.info.innerHTML = text;
        allinfo.info.style.width = "630px";
        allinfo.info.style.left = map.deltaleft + "px";
		allinfo.info.style.top = 0 + "px";
		allinfo.info.style.backgroundColor = "#414141";
		allinfo.info.style.border = "1px solid #adadad";
		allinfo.info.style.display = "block";
	}
	this.panBig = function(){
		//num_photo_view(this.nfo.id_pan);
		allinfo.info.style.display = "none";

		var h = (this.nfo["height"]> 500) ? 500 : this.nfo["height"];
		var w = (this.nfo["width"]>900)? 900 : this.nfo["width"];
		
		h = this.nfo["height"];
		w = this.nfo["width"];
	        
		
		num_photo_view(this.nfo.id_pan);
        var text;
		if (checkFlash()) {
			text = ["<p class='photobig'><a href='#' onclick='allinfo.clearInfo(); return false'><img src='images/close.gif' width='12' height='12' align='right' alt='' /></a><span>", this.nfo["date"], "</span><strong>", this.nfo["author"], "</strong>&nbsp;&nbsp;&nbsp;&nbsp;<em>" + this.nfo["name"], "</em></p><div class='photod big'><center><object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='", w, "' height='", h, "' align='middle'><param name='allowScriptAccess' value='sameDomain' /><param name='allowFullScreen' value='false' /><param name='flashvars' value='url=", this.nfo["img_big"], "&type=", this.nfo["type"], "' /><param name='movie' value='/images/drag.swf' /><param name='quality' value='high' /><embed src='/images/drag.swf' quality='high' width='", w, "' height='", h, "' flashvars='url=", this.nfo["img_big"], "&type=", this.nfo["type"], "' align='middle' allowScriptAccess='sameDomain' allowFullScreen='false' type='application/x-shockwave-flash' pluginspage='http://www.adobe.com/go/getflashplayer' /></object></center></div><p class='count'>", words["count"], this.nfo["img_count"], "</p><p class='biginfo'>", this.nfo["dsc"], "</p><p class='tobig'><span title='Скопировать ссылку в буфер'>Ссылка на панораму: <object id='clip' classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='162' height='16'><param name='allowScriptAccess' value='sameDomain' /><param name='flashvars' value='url=http://", location.host, "/?pan=", this.nfo.id_pan, "'><param name='allowFullScreen' value='false' /><param name='movie' value='/images/clipboard.swf' /><param name='quality' value='high' /><embed src='/images/clipboard.swf' quality='high' width='162' height='16' flashvars='url=http://", location.host, "/?pan=", this.nfo.id_pan, "' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' /></object></span><br/><a href='", this.nfo["img_biggest"], "' target='_blank'>для просмотра исходной версии фотографии нажмите здесь</a><br/>(откроется в новом окне)</p>"].join("");
		}
		else{
			text = ["<p class='photobig'><a href='#' onclick='allinfo.clearInfo(); return false'><img src='images/close.gif' width='12' height='12' align='right' alt='' /></a><span>", this.nfo["date"], "</span><strong>", this.nfo["author"], "</strong>&nbsp;&nbsp;&nbsp;&nbsp;<em>" + this.nfo["name"], "</em></p><div class='photod big'><center><div style='width:800px;height:350px;overflow:auto'><img src='",this.nfo["img_big_noflash"],"'/></div></center></div><p class='count'>", words["count"], this.nfo["img_count"], "</p><p class='biginfo'>", this.nfo["dsc"], "</p><p class='tobig'><span title='Скопировать ссылку в буфер'>Ссылка на панораму: http://", location.host, "/?pan=", this.nfo.id_pan, "</span><br/><a href='", this.nfo["img_biggest"], "' target='_blank'>для просмотра исходной версии фотографии нажмите здесь</a><br/>(откроется в новом окне)</p>"].join("");			
		}
   		allinfo.info.innerHTML = text;
 //       allinfo.info.style.width = "630px";
		allinfo.info.style.width = parseInt(w)+100+"px";
	//	allinfo.info.style.left = (getlnsideWindowWidth()-w-100)/2+"px";
	//	allinfo.info.style.top = 20 + "px";
		allinfo.info.style.left = map.deltaleft + "px";
		allinfo.info.style.top = 0 + "px";
		allinfo.info.style.backgroundColor = "#414141";
		allinfo.info.style.border = "1px solid #adadad";
		allinfo.info.style.display = "block";
	}
	this.imageBig = function(src){
     //   this.show()
		var text = ["<p class='photobig'><a href='#' onclick='allinfo.clearInfo(); return false'><img src='images/close.gif' width='12' height='12' align='right' alt='' /></a></p><div class='photod big'><center><img src='",src,"'/></center></div><p class='tobig'><a href='",src,"' target='_blank'>для просмотра исходной версии фотографии нажмите здесь</a><br/>(откроется в новом окне)</p>"].join("");
   		allinfo.info.innerHTML = text;
        allinfo.info.style.width = "630px";
        allinfo.info.style.left = map.deltaleft + "px";
		allinfo.info.style.top = "1px";
		allinfo.info.style.backgroundColor = "#414141";
        allinfo.info.style.display = "block";
	}
}