// images
<!--//--><![CDATA[//><!--

if (document.images) {
var img = new Object();

img["eye_c"] = new Image(180, 280);
img["eye_c"].src = "./i/zright.jpg";
img["eye_o"] = new Image(180, 280);
img["eye_o"].src = "./i/eye.jpg";

}

//--><!]]> 

// elements

var Cache = new Object();

function get(id)
{
return (Cache[id]) ? Cache[id] : Cache[id] = document.getElementById(id);
}


function getyamap(){
   var map = new YMaps.Map(document.getElementById("YMapsID"));
        map.setCenter(new YMaps.GeoPoint(76.936293,43.259654), 16, YMaps.MapType.MAP);
        map.addControl(new YMaps.Zoom());
        map.addControl(new YMaps.ToolBar());
        map.addControl(new YMaps.TypeControl());        
        var s = new YMaps.Style();
        s.iconStyle = new YMaps.IconStyle();
        s.iconStyle.offset = new YMaps.Point(-8,-27);
        s.iconStyle.href = "http://api-maps.yandex.ru/i/0.3/placemarks/pmwtm.png";
        s.iconStyle.size = new YMaps.Point(28,29);
        YMaps.Styles.add("wizard#wtmPoint", s);

        
        var placemark1 = new YMaps.Placemark(new YMaps.GeoPoint(76.937344,43.258853), {style: "wizard#wtmPoint", balloonOptions: {maxWidth: 300}});
        map.addOverlay(placemark1);
        placemark1.setBalloonContent("ул. Гоголя, 84а, 3-й этаж, офис 304, студия «Сатори» ");        
}

function changetext(i){

txt=document.getElementById('mapd');
ct=document.getElementById('ctable');
	
if (i){
	ct.style.marginTop = "10px";
	txt.innerHTML='<span class="rcross">×</span>&nbsp;<a class="maplink" href="#nomap" onclick="javascript:void(0);">скрыть карту</a>';

if (!window.yamap){getyamap(); window.yamap=true;}

	} else {
txt.innerHTML='<span class="yarrow">▼</span>&nbsp;<a class="maplink" href="#map" onclick="javascript:void(0);">посмотреть на карте</a>';
//ct.style.marginTop = "86px";
	}

}

function getStatFromURI() {
	var uri = window.location.href;
	var sharpPos = uri.indexOf('#');
	
	if (sharpPos == -1)
		return '';
	
	return uri.substr(sharpPos + 1);
}

var slider=function(){
	var array=[]; var speed=2; var timer=10;
	return{
		init:function(t,c){
			var s,ds,l,i,y;
			s=document.getElementById(t); ds=s.getElementsByTagName('div'); l=ds.length; i=y=0;

			for(i=0;i<l;i++){
				var d,did; d=ds[i]; did=d.id;
				if(did.indexOf("header")!=-1){
					y++; d.onclick=new Function("slider.process(this)");
				}else if(did.indexOf("content")!=-1){
					array.push(did.replace('-content','')); d.maxh=d.offsetHeight;
					if(c!=y){d.style.height='0px'; d.style.display='none'}
					else{ if(getStatFromURI()=='map') {d.style.display='block';changetext(1);} else {d.style.height='0px'; d.style.display='none';} }
				} 
			}
		},
		process:function(d){
			var cl,i; cl=array.length; i=0;
			for(i;i<cl;i++){
				var s,h,c,cd;
				s=array[i]; h=document.getElementById(s+'-header');
				c=s+'-content'; cd=document.getElementById(c); clearInterval(cd.timer);
				if(h==d&&cd.style.display=='none'){
					cd.style.display='block'; this.islide(c,1);
				}else if(cd.style.display=='block'){this.islide(c,-1)}
			}
		},
		islide:function(i,d){var c,m; c=document.getElementById(i); m=c.maxh; c.direction=d; c.timer=setInterval("slider.slide('"+i +"')",timer)},
		slide:function(i){ 
			
ct=document.getElementById('ctable');
			
			var c,m,h,dist,mtmt; c=document.getElementById(i); m=c.maxh; h=c.offsetHeight; mtmt=10;
			dist=(c.direction==1)?Math.round((m-h)/speed):Math.round(h/speed);
			if(dist<=1){dist=1}
			c.style.height=h+(dist*c.direction)+'px';  
			if (c.direction==1) {ct.style.marginTop=Math.round(h/32)+'px';} else {mtmt+=76; ct.style.marginTop=mtmt+'px';}

			if(h<2&&c.direction!=1){
				c.style.display='none'; clearInterval(c.timer); changetext(0);}else if(h>(m-2)&&c.direction==1){clearInterval(c.timer); changetext(1);}
		}
};}();