function getScreenWidth()
{
    return window.screen.availWidth;
}

function getScreenHeight()
{
    return window.screen.availHeight;
}

function windowOpenPopup(url, name, width, height)
{
    var left = (getScreenWidth()-width)/2;
    var top = (getScreenHeight()-height)/2;
    width+=0;
    height+=0;
    wId=window.open(url, name, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,left='+left+',top='+top+',width='+width+',height='+height);
    wId.focus();
    return wId;
}

function getOpacityProperty(id)
{
    if (typeof document.getElementById(id).style.opacity == 'string') // CSS3 compliant (Moz 1.7+, Safari 1.2+, Opera 9)
	return 'opacity';
    else if (typeof document.getElementById(id).style.MozOpacity == 'string') // Mozilla 1.6 и младше, Firefox 0.8 
	return 'MozOpacity';
    else if (typeof document.getElementById(id).style.KhtmlOpacity == 'string') // Konqueror 3.1, Safari 1.1
	return 'KhtmlOpacity';
    else if (document.getElementById(id).filters && navigator.appVersion.match(/MSIE ([\d.]+);/)[1]>=5.5) // Internet Exploder 5.5+
	return 'filter';
    return false; //нет прозрачности
}

function setElementOpacity(sElemId, nOpacity)
{
    var opacityProp = getOpacityProperty(sElemId);
    var elem = document.getElementById(sElemId);
    if (!elem || !opacityProp) return;
    	    // Если не существует элемент с указанным id или браузер не поддерживает ни один из известных функции способов управления прозрачностью
    if (opacityProp=="filter")  // Internet Exploder 5.5+
    {
	nOpacity *= 100;
	// Если уже установлена прозрачность, то меняем её через коллекцию filters, иначе добавляем прозрачность через style.filter
	var oAlpha = elem.filters['DXImageTransform.Microsoft.alpha'] || elem.filters.alpha;
	if (oAlpha) oAlpha.opacity = nOpacity;
	else elem.style.filter += "progid:DXImageTransform.Microsoft.Alpha(opacity="+nOpacity+")";
	// Для того чтобы не затереть другие фильтры используем "+="
    }
    else // Другие браузеры
	elem.style[opacityProp] = nOpacity;
}

var NewWindow=null;

function ShowPopup(href) { 
   var WinLeft=Math.floor((screen.width-650-100)/2);
        var WinTop=Math.floor(0);
      if (NewWindow!=null && !NewWindow.closed) {
      NewWindow.close();
   }

   var WinAppearence = 'scrollbars=yes,resize=no,width=700,height='+(screen.height-100)+',top='+WinTop+',left='+WinLeft;

   NewWindow=window.open( href,'NewWindow',WinAppearence);
   NewWindow.focus();
}

