function addBookmark(link, url, title)
{
if (!url) url = location.href;
if (!title) title = document.title;
var ua = navigator.userAgent.toLowerCase();
var isSafari = (ua.indexOf("webkit")!=-1);
var isMac = (ua.indexOf("mac")!=-1);
var key = isMac ? "Command/Cmd" : "Ctrl";
//Gecko
if (window.sidebar && window.sidebar.addPanel)
window.sidebar.addPanel (title, url, "");
//IE
else if(window.external)
window.external.AddFavorite(url, title);
//Opera
else if (window.opera)
{
link.href=url;
link.rel="sidebar";
return true;
}
//Safari
else if (isSafari)
alert("Необходимо нажать "+key+"+D для добавления в избранное");
return false;
}



function getAbsolutePosition(el) {
	var r = { x: el.offsetLeft, y: el.offsetTop };
	if (el.offsetParent) {
		var tmp = getAbsolutePosition(el.offsetParent);
		r.x += tmp.x;
		r.y += tmp.y;
	}
	return r;
}

function setOpacity1(sp1,sp2,sp3,sp4) {
   wh = document.body.clientHeight;
   removeOpacity(sp1,sp2);
   spaceObj = document.getElementById(sp1);   
   spaceObj2 = document.getElementById(sp3); 
   spaceObj3 = document.getElementById(sp4); 
   wh2 = document.documentElement.clientHeight;
   if (wh2>wh)wh=wh2;   
   x=getAbsolutePosition(document.getElementById('zakazon')).x;  
   y=getAbsolutePosition(document.getElementById('zakazon')).y;  
   spaceObj.style.width = "100%";
   spaceObj.style.height = wh + 'px';
   spaceObj.style.display = "block";
   spaceObj.style.opacity = 0.5;
   spaceObj.style.filter = 'alpha(opacity=10)';
   spaceObj2.style.width = "100%";
   spaceObj2.style.height = "100%";
   spaceObj2.style.display = "block";
   spaceObj3.style.marginTop = y+40 + 'px';
   spaceObj3.style.marginLeft = x-570 + 'px';
}

function setOpacity3() {
   spaceObj = document.getElementById('spacespace');   
   spaceObj2 = document.getElementById('space4'); 
   wh = document.body.clientHeight;
   wh2 = document.documentElement.clientHeight;
   if (wh2>wh)wh=wh2;   
   spaceObj.style.width = "100%";
   spaceObj.style.height = wh + 'px';
   spaceObj.style.display = "block";
   spaceObj.style.opacity = 0.2;
   spaceObj.style.filter = 'alpha(opacity=20)';
   spaceObj2.style.width = "100%";
   spaceObj2.style.height = "100%";
   spaceObj2.style.display = "block";
}




function removeOpacity(sp1,sp2) {
   spaceObj = document.getElementById(sp1);
   spaceObj2 = document.getElementById(sp2);
   spaceObj.style.opacity = 0;
   spaceObj.style.filter = 'alpha(opacity=0)';
   spaceObj.style.display = "none";
   spaceObj2.style.opacity = 10;
   spaceObj2.style.filter = 'alpha(opacity=100)';
   spaceObj2.style.display = "none";
}



function checkform()
{
	f=document.forms['zf'];
	re=/\s/gi;
	k= f.text1.value; 
    if (k.length<0 || (k.replace(re,'')).length<1) {setOpacity3(); return false;}
	f.submit(); 
}




