// JavaScript Document
function displayoff(id)
{
zid=document.getElementById(id);
fadeOpacity(id, 'prez');
var t = setTimeout('zid.style.display="none"',700);
//zid.style.display="none";
//clearTimeout(t);

}

function zoom(zid)
	{
		
		zid2=document.getElementById(zid);
		
		fadeOpacity(zid, 'imgz');
		
		
	for (k = 0; k<=25 ; k++)
		{  
		
			id='zoom'+k;
			//fadeOpacity(id, 'imgz');
			zidall=document.getElementById(id);
			if (zidall!=null){
				if (zidall.style.display!="none"){
					
			fadeOpacity.back(id);
			zidall.style.display="none";}
			
			//if (zidall==zid) { 
			//fadeOpacity.back(zidall);
				//zid.style.display="";
				//fadeOpacity(zid, 'oR1');
				}//}
		}
	zid2.style.display="";
	
	}
/*
function displaymenu(mid)
{
txt=document.getElementById('maintext');
if (mid.style.display!="none") { 
mid.style.display="none";
if (txt!=null){txt.style.color="#696b6d";}
}
else{
if (txt!=null){txt.style.color="#2e2f30";}
for (k = 1; k<=2 ; k++)
		{
			id='menu'+k;
			midd=document.getElementById(id);
			if (midd!=null){
			midd.style.display="none";
			if (midd==mid) { 
				mid.style.display="";
				}}
		}

}
}
*/

function getElementComputedStyle(elem, prop)
{
  if (typeof elem!="object") elem = document.getElementById(elem);
  
  // external stylesheet for Mozilla, Opera 7+ and Safari 1.3+
  if (document.defaultView && document.defaultView.getComputedStyle)
  {
    if (prop.match(/[A-Z]/)) prop = prop.replace(/([A-Z])/g, "-$1").toLowerCase();
    return document.defaultView.getComputedStyle(elem, "").getPropertyValue(prop);
  }
  
  // external stylesheet for Explorer and Opera 9
  if (elem.currentStyle)
  {
    var i;
    while ((i=prop.indexOf("-"))!=-1) prop = prop.substr(0, i) + prop.substr(i+1,1).toUpperCase() + prop.substr(i+2);
    return elem.currentStyle[prop];
  }
  return "";
}


function motion(idd,y)
{
 var obj = document.getElementById(idd);
 var x = parseInt(getElementComputedStyle(idd, 'height'));
  if (x>=y) {clearInterval(t);}
  else {
 obj.style.height = x + 5 + "px";}
}

function motion_close(idd)
{
 var obj = document.getElementById(idd);
 var z = parseInt(getElementComputedStyle(idd, 'height'));
 if (z<10) {clearInterval(t1); obj.style.display="none";}
  obj.style.height = z - 5 + "px";
}

function displaymenu(mid1,x1)
{
txt=document.getElementById('maintext');
mid=document.getElementById(mid1);
	if (mid.style.display!="none") { 
		s=mid1;
		t1=setInterval("motion_close(s)",10);	
		if (txt!=null){txt.style.color="#696b6d";}
	}
	else{
		if (txt!=null){txt.style.color="#1f1f20";}
		for (k = 1; k<=2 ; k++)
		{
			id='menu'+k;
			midd=document.getElementById(id);
			if (midd!=null){
				if (midd.style.display!="none") { 
					s=id;
					t1=setInterval("motion_close(s)",10);
		
					}
				if (midd==mid) {sid=id; x=x1;
					mid.style.display="";
					t=setInterval("motion(sid,x)",10);
					}
			}
		}

	}
}



function foninmenuon(fon)
{ 
fadeOpacity.addRule('oR1', 0.1, 0.7, 30);
id="topfon";
fadeOpacity(id, 'oR1');
//fid=document.getElementsByTagName("li");
//for (var i = 0; i < fid.length; i++) {
//fid[i].style.backgroundColor="<?=$fon?>";}

//fid=document.getElementById(id);
//fid.style.backgroundColor=fon;

//t=setInterval(motion,10);

}
function foninmenuoff()
{ //clearInterval(t);
id="topfon";
//fid=document.getElementsByTagName("li");
//for (var i = 0; i < fid.length; i++) {
//fid[i].style.backgroundColor="transparent";}
fid=document.getElementById(id);
fid.style.backgroundColor="transparent";
}
// из шаблона G
function type1(){
name='desc';
descid=document.getElementById(name);

descid.style.left=245 + eval(document.documentElement.scrollLeft||document.body.scrollLeft) + "px" ;
}

function  forspam2(user,site) {
document.write('<a href=\"mailto:' + user + '@' + site + '\">');
document.write(user + '@' + site + '</a>');
}

/*
setElementOpacity - установка прозрачности
getOpacityProperty - проверка, есть ли возможность менять прозрачность
fadeOpacity - плавное изменение прозрачности
*/
function setElementOpacity(oElem, nOpacity)
{
	var p = getOpacityProperty();
	(setElementOpacity = p=="filter"?new Function('oElem', 'nOpacity', 'nOpacity *= 100;	var oAlpha = oElem.filters["DXImageTransform.Microsoft.alpha"] || oElem.filters.alpha;	if (oAlpha) oAlpha.opacity = nOpacity; else oElem.style.filter += "progid:DXImageTransform.Microsoft.Alpha(opacity="+nOpacity+")";'):p?new Function('oElem', 'nOpacity', 'oElem.style.'+p+' = nOpacity;'):new Function)(oElem, nOpacity);
}

function getOpacityProperty()
{
	var p;
	if (typeof document.body.style.opacity == 'string') p = 'opacity';
	else if (typeof document.body.style.MozOpacity == 'string') p =  'MozOpacity';
	else if (typeof document.body.style.KhtmlOpacity == 'string') p =  'KhtmlOpacity';
	else if (document.body.filters && navigator.appVersion.match(/MSIE ([\d.]+);/)[1]>=5.5) p =  'filter';
	
	return (getOpacityProperty = new Function("return '"+p+"';"))();
}

/* Функции для плавного изменения прозрачности:*/
function fadeOpacity(sElemId, sRuleName, bBackward)
{
	var elem = document.getElementById(sElemId);
	if (!elem || !getOpacityProperty() || !fadeOpacity.aRules[sRuleName]) return;
	
	var rule = fadeOpacity.aRules[sRuleName];
	var nOpacity = rule.nStartOpacity;
	
	if (fadeOpacity.aProc[sElemId]) {clearInterval(fadeOpacity.aProc[sElemId].tId); nOpacity = fadeOpacity.aProc[sElemId].nOpacity;}
	if ((nOpacity==rule.nStartOpacity && bBackward) || (nOpacity==rule.nFinishOpacity && !bBackward)) return;

	fadeOpacity.aProc[sElemId] = {'nOpacity':nOpacity, 'tId':setInterval('fadeOpacity.run("'+sElemId+'")', fadeOpacity.aRules[sRuleName].nDalay), 'sRuleName':sRuleName, 'bBackward':Boolean(bBackward)};
}

fadeOpacity.addRule = function(sRuleName, nStartOpacity, nFinishOpacity, nDalay){fadeOpacity.aRules[sRuleName]={'nStartOpacity':nStartOpacity, 'nFinishOpacity':nFinishOpacity, 'nDalay':(nDalay || 30),'nDSign':(nFinishOpacity-nStartOpacity > 0?1:-1)};};

fadeOpacity.back = function(sElemId){fadeOpacity(sElemId,fadeOpacity.aProc[sElemId].sRuleName,true);};

fadeOpacity.run = function(sElemId)
{
	var proc = fadeOpacity.aProc[sElemId];
	var rule = fadeOpacity.aRules[proc.sRuleName];
	
	proc.nOpacity = Math.round(( proc.nOpacity + .1*rule.nDSign*(proc.bBackward?-1:1) )*10)/10;
	setElementOpacity(document.getElementById(sElemId), proc.nOpacity);
	
	if (proc.nOpacity==rule.nStartOpacity || proc.nOpacity==rule.nFinishOpacity) clearInterval(fadeOpacity.aProc[sElemId].tId);
}
fadeOpacity.aProc = {};
fadeOpacity.aRules = {};

function GMapInit() {
	// Инициализация класса Google Maps и расположение карты в слое GMapContainer
	var map = new GMap2(document.getElementById("GMapContainer"));

	// Задаем настройки вывода
	map.setCenter(new GLatLng(55.810229,37.649674), 15); 	// Широта, долгота и коэффициент
																			// увеличения цента (обязательный параметр)
	map.addControl(new GLargeMapControl()); // Добавляем на карту Google Maps управление прокруткой и приближением
	map.addControl(new GMapTypeControl());  // Добавляем на карту Google Maps возможность выбрать тип отображения
	map.addControl(new GOverviewMapControl());

var point = new GLatLng(55.80955366656286,37.6530647277832); 
var marker = new GMarker(point, {title: "5 points"});
map.addOverlay(marker);

}
