function ShowBlockNot(targetN)
{
	Alert('fh');
	var contanerN = document.getElementById(targetN);
	if (contanerN.style.visibility == "visible")
	{
		contanerN.style.visibility = "hidden";
	}
}

function createXMLHttp() {
    if (typeof XMLHttpRequest != "undefined") { // для браузеров аля Mozilla

        return new XMLHttpRequest();
    } else if (window.ActiveXObject) { // для Internet Explorer (all versions)
        var aVersions = ["MSXML2.XMLHttp.5.0", "MSXML2.XMLHttp.4.0",
                   "MSXML2.XMLHttp.3.0", "MSXML2.XMLHttp",
                   "Microsoft.XMLHttp"
                   ];
        for (var i = 0; i < aVersions.length; i++) {
            try { //
                var oXmlHttp = new ActiveXObject(aVersions[i]);

                return oXmlHttp;
            } catch (oError) {

            }
        }
        throw new Error("Невозможно создать объект XMLHttp.");
    }
}

function newContent(link, target) 
{
    var WinParm = new Array(4);
		WinParm = getPageSize();
    link = link + '&h='+WinParm[2]+'&w='+WinParm[3];
    
    var contaner = document.getElementById(target);
    contaner.innerHTML = 'Загрузка ...';
    var resource = createXMLHttp();
    if (resource) 
    {
        resource.open('GET', link, true);
        resource.onreadystatechange = function ()
        {
            if (resource.readyState == 4)
            {
                contaner.innerHTML = resource.responseText;
            }
        }
        resource.send(null);
    }
    else
    {
        document.location = link;
    }
 }
 

function getRequestBody(oForm) //Обработка метода POST
{
    var aParams = new Array();
    for (var i = 0; i < oForm.elements.length; i++) {
        var sParam = encodeURIComponent(oForm.elements[i].name);
        sParam += "=";
        sParam += encodeURIComponent(oForm.elements[i].value);
        aParams.push(sParam);
    }
    return aParams.join("&");
}

function sendRequest(FormName, TargetName)
{
    var oForm = document.forms[FormName];
    var sBody = getRequestBody(oForm);
    var oXmlHttp = createXMLHttp();

    oXmlHttp.open("POST", oForm.action, true);
    //oXmlHttp.setRequestHeader("Content-Type", "'" + TargetName.option.contentType + "; charset=" + TargetName.option.encoding + "'");
    //oXmlHttp.setRequestHeader("Content-Type, text/xml; charset=utf-8");

    oXmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    //oXmlHttp.setRequestHeader("Accept-Charset", "utf-8");
    //oXmlHttp.setRequestHeader("Content-length", data.length);
    //oXmlHttp.setRequestHeader("Connection", "close");
    
    oXmlHttp.onreadystatechange = function() {
        if (oXmlHttp.readyState == 4) {
            if (oXmlHttp.status == 200) {
                saveResult(oXmlHttp.responseText, TargetName);
            } else {
                saveResult("Ошибка: " + oXmlHttp.statusText, TargetName);
            }
        }
    };

    oXmlHttp.send(sBody);
}

function saveResult(sText, TargetName) 
{
    var sElem = document.getElementById(TargetName);
    sElem.innerHTML = sText;
}

function  getPageSize(){
        var xScroll, yScroll;

        if (window.innerHeight && window.scrollMaxY) {
               xScroll = document.body.scrollWidth;
               yScroll = window.innerHeight + window.scrollMaxY;
       } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
                xScroll = document.body.scrollWidth;
                yScroll = document.body.scrollHeight;
        } else if (document.documentElement && document.documentElement.scrollHeight > document.documentElement.offsetHeight){ // Explorer 6 strict mode
                xScroll = document.documentElement.scrollWidth;
                yScroll = document.documentElement.scrollHeight;
        } else { // Explorer Mac...would also work in Mozilla and Safari
                xScroll = document.body.offsetWidth;
                yScroll = document.body.offsetHeight;
       }


        var windowWidth, windowHeight;
        if (self.innerHeight) { // all except Explorer
                windowWidth = self.innerWidth;
                windowHeight = self.innerHeight;
        } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
                windowWidth = document.documentElement.clientWidth;
                windowHeight = document.documentElement.clientHeight;
        } else if (document.body) { // other Explorers
                windowWidth = document.body.clientWidth;
                windowHeight = document.body.clientHeight;
        }


        // for small pages with total height less then height of the viewport
        if(yScroll < windowHeight){
                pageHeight = windowHeight;
        } else {
                pageHeight = yScroll;
        }


        // for small pages with total width less then width of the viewport
        if(xScroll < windowWidth){
                pageWidth = windowWidth;
        } else {
                pageWidth = xScroll;
        }


        return [pageWidth,pageHeight,windowWidth,windowHeight];
 }


