//  mp js (multi purpose)
//  send - for gb oper
function send(href)
{
function getxmlhttp()
{
var xmlhttp;
try
{
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
    try
    {
    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    catch (e)
    {
    xmlhttp = false;
    }
}
if (!xmlhttp && typeof XMLHttpRequest!='undefined')
    {
    xmlhttp = new XMLHttpRequest();
    }
return xmlhttp;
};
var xmlhttp = getxmlhttp()
xmlhttp.open("GET", href, true);
xmlhttp.onreadystatechange = function()
{
    if (xmlhttp.readyState == 4)
    {
        if(xmlhttp.status == 200)
        {
        document.getElementById("term").innerHTML = xmlhttp.responseText;
        }
    }
};
xmlhttp.send(null);
};

//  sendparm 
function sendparm(href, elid, parm)
{
function getxmlhttp()
{
var xmlhttp;
try
{
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
    try
    {
    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    catch (e)
    {
    xmlhttp = false;
    }
}
if (!xmlhttp && typeof XMLHttpRequest!='undefined')
    {
    xmlhttp = new XMLHttpRequest();
    }
return xmlhttp;
};
var xmlhttp = getxmlhttp()

if (typeof parm == "undefined")
    {
    var qs = "no=data";
    }
else
    {
    var qs = parm;
    };
xmlhttp.open('GET', href+"?"+qs+"&rand="+Math.random(), true);
if (typeof elid == "undefined")
    {
    alert('кто то забыл указать id блока!!');
    };
xmlhttp.onreadystatechange = function()
{
    if (xmlhttp.readyState == 4)
    {
        if(xmlhttp.status == 200)
        {
        document.getElementById(elid).innerHTML = xmlhttp.responseText;
        }
    }
};
xmlhttp.send(null);
};


//  sendform 
function sendform(href, fn, node)
{
function getxmlhttp()
{
var xmlhttp;
try
{
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
    try
    {
    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    catch (e)
    {
    xmlhttp = false;
    }
}
if (!xmlhttp && typeof XMLHttpRequest!='undefined')
    {
    xmlhttp = new XMLHttpRequest();
    }
return xmlhttp;
};
var qn = ((document.getElementById(fn).length) - 1);
var parm = document.getElementById(fn).elements[0].name + "=" + encodeURIComponent(document.getElementById(fn).elements[0].value);
for (var i = 1; i < qn; i++)
{
parm = parm + "&" + document.getElementById(fn).elements[i].name + "=" + encodeURIComponent(document.getElementById(fn).elements[i].value);
};
var xmlhttp = getxmlhttp()
xmlhttp.open("GET", href+"?"+parm+"&rand="+Math.random(), true);
xmlhttp.onreadystatechange = function()
{
    if (xmlhttp.readyState == 4)
    {
        if(xmlhttp.status == 200)
        {
        document.getElementById(node).innerHTML = xmlhttp.responseText;
        }
    }
};
xmlhttp.send(null);
};

//  remove object value (from input)
function rem_vall(inputv)
    {
    inputv.value = '';
    inputv.onfocus = null;
    }


//  remove dash (from input)
function rem_dash(inputv)
    {
    if (inputv.value == '--')
    {
    inputv.value = '';
    };
    };


//  restore dash (to input)
function res_dash(inputv)
    {
    if (inputv.value == '')
    {
    inputv.value = '--';
    };
    };


//  count chars (for texarea input)
function cc(conm, coid)
{
    var mxln = window.document.getElementById(coid).getAttribute('maxlength');
    if (window.document.getElementById(coid).value.length <= mxln)
        {
        document.getElementById(conm).innerHTML = (mxln - window.document.getElementById(coid).value.length);
        }
    else
        {
        document.getElementById(coid).value = (document.getElementById(coid).value.substr(0, mxln));
        };
};


//  display form
function sf(disc, hide, none)
{
document.getElementById(hide).style.display = "none";
document.getElementById(disc).style.display = "block";
document.getElementById(none).style.visibility = "hidden";
};


//  turn photo description fields to write mode 
function able(form)
{
document.getElementById(form).disabled = false;
};


//  turn photo description fields to readonly mode
function na(form)
{
document.getElementById(form).disabled = true;
};

//  end of mp (multi purpose)
