var _onclick = null,
    _popup = 0,
    _noHide = false;
                          
function showPopup(id){ 
    setTimeout("eval('_showPopup("+id+");')", 111);                           
    if(_popup>0 && _popup!=id) _hidePopup(_popup);    
}
                                       
function hidePopup(id){           
    if(_noHide) return false;
    setTimeout("eval('_hidePopup("+id+");')", 499);
}               
    
function _hidePopup(id){                              
    document.getElementById("shopPopup"+id).style.display = "none";    
    document.onclick = _onclick;    
    _popup = 0;    
    _noHide = false;
}    

function _showPopup(id){    
    document.getElementById("shopPopup"+id).style.display = "block";    
    _onclick = document.onclick;            
    document.onclick = function(){_hidePopup(id);};
    _popup = id;                        
    _noHide = true;
    setTimeout("eval('_noHide=false;')", 1001);    
}

function findPoint(evt){                
   var e = getPageEventCoords(evt||event),
       s = getElementPosition("theMap");   
   alert("Óêàçàíû êîîðäèíàòû:"
         +"\n X = "+(parseInt(e.left)-parseInt(s.left))
         +"\n Y = "+(parseInt(e.top)-parseInt(s.top)));   
}

function getPageEventCoords(evt) {
    var coords = {left:0, top:0};       
    if (evt.pageX) {
        coords.left = evt.pageX;
        coords.top = evt.pageY;
    } else if (evt.clientX) {
        coords.left = 
            evt.clientX + document.body.scrollLeft - document.body.clientLeft;
        coords.top = 
            evt.clientY + document.body.scrollTop - document.body.clientTop;
        // include html element space, if applicable
        if (document.body.parentElement && document.body.parentElement.clientLeft) {
            var bodParent = document.body.parentElement;
            coords.left += bodParent.scrollLeft - bodParent.clientLeft;
            coords.top += bodParent.scrollTop - bodParent.clientTop;
        }
    }
    return coords;
} 

function getElementPosition(elemID) {
    var offsetTrail = document.getElementById(elemID);
    var offsetLeft = 0;
    var offsetTop = 0;
    while (offsetTrail) {
        offsetLeft += offsetTrail.offsetLeft;
        offsetTop += offsetTrail.offsetTop;
        offsetTrail = offsetTrail.offsetParent;
    }
    if (navigator.userAgent.indexOf("Mac") != -1 && 
        typeof document.body.leftMargin != "undefined") {
        offsetLeft += document.body.leftMargin;
        offsetTop += document.body.topMargin;
    }
    return {left:offsetLeft, top:offsetTop};
}


function goToURL() { //v3.0
	selector = document.getElementById("cities");
	if (selector.value != "")
	{		
		document.MM_returnValue = false;
		eval("parent.location='/store/city/show/"+selector.value+".htm'");
	}	
}<!--LiveInternet counter--><script type="text/javascript"><!--
				document.write("<a href='http://www.liveinternet.ru/click' "+
				"target=_blank><img src='http://counter.yadro.ru/hit?t0.10;r"+
				escape(document.referrer)+((typeof(screen)=="undefined")?"":
				";s"+screen.width+"*"+screen.height+"*"+(screen.colorDepth?
				screen.colorDepth:screen.pixelDepth))+";u"+escape(document.URL)+
				";"+Math.random()+
				"' alt='' title='LiveInternet: Ð¿Ð¾ÐºÐ°Ð·Ð°Ð½Ð¾ Ñ‡Ð¸ÑÐ»Ð¾ Ð¿Ñ€Ð¾ÑÐ¼Ð¾Ñ‚Ñ€Ð¾Ð² Ð¸"+
				" Ð¿Ð¾ÑÐµÑ‚Ð¸Ñ‚ÐµÐ»ÐµÐ¹ Ð·Ð° 24 Ñ‡Ð°ÑÐ°' "+
				"border='0' width=1 height=1><\/a>")
				//--></script><!--/LiveInternet-->
